Closed ragrets closed 4 years ago
I'm not quite sure what you're trying to accomplish. Do you want the songs
variable to be a list of all of the lyrics?
In your songs.append(f"{x + 1}: {(song_list)[x][0]}")
line, you are asking for the string representation of the Song class, so you're calling its __str__
method, which includes a snippet of the song's lyrics.
If you want just the song lyrics, try something like this:
x = 0
while x < len(song_list):
songs.append(f"{x + 1}: {(song_list)[x].lyrics}")
x = x + 1
print(songs)
Does that address your question?
Closing this issue, as I believe the above code will fix the problem. Feel free to comment again or open a new issue if necessary.
Am I missing something? I initially printed
song_list
to see its contentbut I don't see where the 2nd print got the lyrics
Also, I get "Song object is not subscriptable" when i try to access the song names by: