import json with open('json/cards.json') as f: x = json.load(f) text = "" for i in x["cards"]: text += f"""

{i["name"]}

{i["description"]}

""" if i["tor"] != "#": text += f'' text += "
" with open('_site/index.html') as f: y = f.read() y = y.replace('', text) with open('_site/index.html', 'w') as f: f.write(y)