您的位置:首页 > 编程语言 > Python开发

python查询sqlite数据表的方法

2015-05-08 10:11 1016 查看
import sqlite3 as db
conn = db.connect('mytest.db')
conn.row_factory = db.Row
cursor = conn.cursor()
cursor.execute("select * from person")
rows = cursor.fetchall()
for row in rows:
print("%s %s %s" % (row["name"], row["age"], row["address"]))
conn.close()

希望本文所述对大家的Python程序设计有所帮助。

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python sqlite