博客园 :: :: 新随笔 :: :: :: 管理 ::

python 读取sqlite3 数据库

 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])

 

posted on 2015-05-13 13:59  #include<stdio.h>  阅读(1267)  评论(0)    收藏  举报