snippets:python:db
Differences
This shows you the differences between two versions of the page.
| snippets:python:db [2026-04-01 16:14] – created malte70 | snippets:python:db [2026-04-01 17:39] (current) – malte70 | ||
|---|---|---|---|
| Line 31: | Line 31: | ||
| </ | </ | ||
| + | ===== SQLite ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | ==== Beispiel ==== | ||
| + | |||
| + | <code python [enable_line_numbers=" | ||
| + | import os | ||
| + | import sqlite3 | ||
| + | |||
| + | |||
| + | DB = " | ||
| + | |||
| + | |||
| + | DB = os.path.expanduser( | ||
| + | os.path.expandvars(DB) | ||
| + | ) | ||
| + | if not os.path.exists(DB): | ||
| + | pass | ||
| + | |||
| + | con = sqlite3.connect(DB) | ||
| + | cur = con.cursor() | ||
| + | cur.execute(" | ||
| + | </ | ||
snippets/python/db.1775060091.txt.gz · Last modified: by malte70
