1116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandlimport sqlite3 2116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandl 31ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinencon = sqlite3.connect(":memory:") 4116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandlcur = con.cursor() 51ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinencur.execute("create table people (name_last, age)") 6116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandl 7116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandlwho = "Yeltsin" 8116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandlage = 72 9116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandl 101ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinen# This is the qmark style: 111ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinencur.execute("insert into people values (?, ?)", (who, age)) 121ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinen 131ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinen# And this is the named style: 141ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinencur.execute("select * from people where name_last=:who and age=:age", {"who": who, "age": age}) 151ca93954e17e4f6f1230306997badbda3e5c68bcPetri Lehtinen 16116aa62bf54a39697e25f21d6cf6799f7faa1349Georg Brandlprint(cur.fetchone()) 17