1import sqlite3
2
3con = sqlite3.connect(":memory:")
4cur = con.cursor()
5cur.execute("create table people (name_last, age)")
6
7who = "Yeltsin"
8age = 72
9
10# This is the qmark style:
11cur.execute("insert into people values (?, ?)", (who, age))
12
13# And this is the named style:
14cur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age})
15
16print(cur.fetchone())
17
18con.close()
19