1 import sqlite3 2 3 name = "tom" 4 age = 30 5 con = sqlite3.connect("d:\\test.db") 6 cur = con.cursor() 7 #cur.execute("select * from user") 8 cur.execute("select * from user where age = %d" %age) 9 10 for x in cur: 11 print (x[0],x[1])
1 import sqlite3 2 3 name = "tom" 4 age = 30 5 con = sqlite3.connect("d:\\test.db") 6 cur = con.cursor() 7 #cur.execute("select * from user") 8 cur.execute("select * from user where age = %d" %age) 9 10 for x in cur: 11 print (x[0],x[1])
转载于:https://www.cnblogs.com/jhcla/p/4500240.html