Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

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