Bureaucrats, cc_docs_admin, cc_staff
2,318
edits
(→R) |
|||
Line 15: | Line 15: | ||
===Python=== | ===Python=== | ||
For Python we can use the module <tt>sqlite3</tt>, installed in a virtual environment, to access an SQLite database: | |||
{{File | |||
|name=sqlite.py | |||
|lang="python" | |||
|contents= | |||
#!/usr/bin/env python3 | |||
import sqlite3 | |||
dbase = sqlite3.connect("foo.sqlite") | |||
crs = dbase.cursor() | |||
params = ("employees",) | |||
crs.execute("SELECT * FROM ?;",params) | |||
rows = crs.fetchall() | |||
for r in rows: | |||
print(r) | |||
dbase.close() | |||
}} | |||
===R=== | ===R=== | ||