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.

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.

Suggested posts