~fkfd/one_top_song

one_top_song/data/mkhtml_all.py -rw-r--r-- 480 bytes
26ca7fbcFrederick Yin Remove "ripped" (Redecorate) 10 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import json

f = open("words.json")
words = json.load(f)
f.close()

html = ""
track = ""

for word in words:
    html += "<tr>"
    if word["track"] != track:
        track = word["track"]
        words_from_track = len([w for w in words if w["track"] == track])
        html += f"<td rowspan={words_from_track}>{track}</td>"

    html += f"<td>{word['word']}</td><td>{'<br/>'.join(word['lines'])}</td></tr>\n"

htmlf = open("all_words.html", "w")
htmlf.write(html)
htmlf.close()