Das Beispiel von der pickledb-Webseite:
from pickledb import PickleDB # Bind to a JSON file; no I/O yet db = PickleDB("data.json") db.load() db.set("username", "alice") db.set("theme", { "color": "blue", "font": "sans-serif" }) print(db.get("username")) # → "alice" db.save() # atomically write to disk
import os import sqlite3 DB = "~/python.sqlite3" DB = os.path.expanduser( os.path.expandvars(DB) ) if not os.path.exists(DB): pass con = sqlite3.connect(DB) cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS ...")