python连接数据库查询
时间:2021-07-01 10:21:17
帮助过:3人阅读
sqlite3 as db
conn = db.connect(r
‘D:/data/test.db‘)
print (
‘Opend database successfully \n‘)
#conn.row_factory = db.Row
cursor =
conn.cursor()
results = cursor.execute(
"select * from Meter")
rows =
cursor.fetchall()
for row
in rows:
print(row)
#"%s %s %s" % (row["id"], row["No"], row["Name"])
print(
‘\n‘)
print (
‘close database successfully‘)
conn.close()
python连接数据库查询
标签:nbsp 连接 div sqlite cursor rom sel pen tab