how can i access an object within a list of them?

song is the key in the dictionary. If you want to get the artist, you must look up the key song in the dictionary data, and artist should be a string:

for song in data:
    # song is "1"
    # data[song] is {"artist": "Ariana Grande", "title": "Positions"}
    print(data[song]["artist"])

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top