import os , json folder = "./images/" #load the json information with open("cards.json", "r") as collage: cards = json.load(collage) #html all_cards = "" for card in cards["cards"]: print(card) #html image element img = f"" #img = "" #define title title = card['name'] #printing to inspect print(img) #mini template for card if card['image'] == "": card = f"""

{ title }

{ card['text'] }

""" else: card = f"""

{ title }

{ img }

{ card['text'] }

""" #printing to inspect mini template print(card) #add it to the all cards variable all_cards = all_cards + card #we add +1 to our counter html = f""" flex card

cards

{ all_cards }
""" with open("cards.html", "w") as output: output.write(html)