Announcements

Help Wizard

Step 1

NEXT STEP

How to iterate over a playlist in reversed order?

Solved!

How to iterate over a playlist in reversed order?

I am writing a simple program using python and library spotipy. How can I iterate over a collection "Liked Songs" in reversed order?

Reply

Accepted Solutions
Marked as solution

That is not possible with Spotipy, but it is with python: save all the track IDs into a list, and reverse that list.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

View solution in original post

3 Replies

Have you tried Python's reverse() function? You should get back an array of track ids and then you call reverse() on it. https://www.w3schools.com/python/ref_list_reverse.asp

Maybe I will be more specific. What I need is to iterate through user's Liked Songs collection from the end to the top (in reversed order), but I do not understand how to achieve this with spotipy.

Marked as solution

That is not possible with Spotipy, but it is with python: save all the track IDs into a list, and reverse that list.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts

Let's introduce ourselves!

Hey there you, Ā  Yeah, you!Ā 😁 Ā  Welcome - we're glad you joined the Spotify Community! Ā  While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random