iterating through JSON results can get quite confusing at times.
say I have a functionlike so:
def get_playlist_owner_ids(query):
results = sp.search(q=query, type='playlist')
id_ = results['playlists']['items'][0]['owner']['id']
return (id_)
I can fetch the id_, it works.
but how do I iterate using a for i in x loop so I return ALL ids_?
ids? You need to show us the structure of yourresultsdata structure (and which level or levels you want theidvalues from) in order for this to be answerable. Maybe you want[x['owner']['id'] for x in results['playlists']['items']], but that's just a guess.