import json import sqlite3 db = sqlite3.connect("mensa.db") rows = db.execute(""" SELECT date, mensa, type, title, description, category, allergens FROM dishes ORDER BY rowid DESC LIMIT 3 """).fetchall() for date, mensa, typ, title, description, category, allergens in rows: print(f"{date} | {mensa} | {typ}") print(f" {title}") print(f" {description}") print(f" category: {', '.join(json.loads(category))}") print(f" allergens: {', '.join(json.loads(allergens))}") print() db.close()