feat: Initial commit
This commit is contained in:
31
simulazioni/discografia/main.py
Normal file
31
simulazioni/discografia/main.py
Normal file
@@ -0,0 +1,31 @@
|
||||
songs = dict()
|
||||
|
||||
artists = open("artisti.txt", "r")
|
||||
|
||||
for artist in artists:
|
||||
artist = artist.split(";")
|
||||
artCode = artist[0].strip()
|
||||
|
||||
songsFile = open(artist[1].strip(), "r")
|
||||
|
||||
for song in songsFile:
|
||||
song = song.split(";", 1)
|
||||
year = song[0]
|
||||
title = song[1].strip()
|
||||
|
||||
if year not in songs:
|
||||
songs[year] = []
|
||||
|
||||
songs[year].append({"artist": artCode, "title": title})
|
||||
|
||||
songsFile.close()
|
||||
|
||||
artists.close()
|
||||
|
||||
years = sorted(list(songs.keys()))
|
||||
|
||||
for year in years:
|
||||
print(year + ":")
|
||||
|
||||
for s in songs[year]:
|
||||
print(s["title"] + "\t" + s["artist"])
|
||||
Reference in New Issue
Block a user