File size: 412 Bytes
e9b84ca
 
 
 
 
 
 
 
 
0b42d7c
 
 
909b6fe
e9b84ca
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json

class ListSongs:
    @staticmethod
    def get_song_list():
        list_output = ""

        with open("./swedish_christmas_songs.json", "r", encoding='utf-8') as f: 
            songs = json.load(f)
            sorted_songs = sorted(songs, key=lambda k: k['name'])

            for song in sorted_songs:
                list_output += "- " + song['name'] + "\n"

        return list_output.strip()