You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
405 B
Python
18 lines
405 B
Python
2 years ago
|
import json
|
||
|
from jinja2 import Environment, FileSystemLoader
|
||
|
|
||
|
with open("playlist.json","r") as d:
|
||
|
playlist = json.load(d)
|
||
|
|
||
|
fileLoader = FileSystemLoader("templates")
|
||
|
env = Environment(loader=fileLoader)
|
||
|
|
||
|
rendered = env.get_template("playlist.html").render(playlist=playlist,title="Test")
|
||
|
|
||
|
#print(playlist)
|
||
|
|
||
|
# write to html
|
||
|
fileName = "index.html"
|
||
|
|
||
|
with open(f"{fileName}","w") as f:
|
||
|
f.write(rendered)
|