Spaces:
Sleeping
Sleeping
sharner
commited on
Commit
•
0b42d7c
1
Parent(s):
42aeede
Make song list output sorted
Browse files- list_songs.py +3 -2
list_songs.py
CHANGED
@@ -7,8 +7,9 @@ class ListSongs:
|
|
7 |
|
8 |
with open("./swedish_christmas_songs.json", "r", encoding='utf-8') as f:
|
9 |
songs = json.load(f)
|
10 |
-
|
11 |
-
|
|
|
12 |
list_output += "- " + song['name'] + "\n"
|
13 |
|
14 |
return list_output.strip()
|
|
|
7 |
|
8 |
with open("./swedish_christmas_songs.json", "r", encoding='utf-8') as f:
|
9 |
songs = json.load(f)
|
10 |
+
sorted_songs = sorted(songs, key=lambda k: k['name'])
|
11 |
+
|
12 |
+
for song in sorted_songs:
|
13 |
list_output += "- " + song['name'] + "\n"
|
14 |
|
15 |
return list_output.strip()
|