song = {
"artist": "The Beatles",
"title": "Strawberry Fields Forever",
"feat": None,
"album": "Magical Mystery Tour",
"album_type": "정규 앨범",
"cover": "/assets/music/magical-mystery-tour.jpg",
"track": 8,
"year": 1967,
"youtube": "HtUH9z_Oey8"
}
from IPython.display import HTML
HIDDEN = {"youtube"} # 영상은 아래 칸에서 재생
def show(k, v):
if k == "cover":
return f'<img src="{v}" alt="{song["album"]} 커버" width="200">'
return v
HTML('<table>' + ''.join(f'<tr><th>{k}</th><td>{show(k, v)}</td></tr>' for k, v in song.items() if v is not None and k not in HIDDEN) + '</table>')