import 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()
时间: 2024-10-13 03:55:52