0
我有一個問題,讓fetchall返回正確的數據類型。 fetchone確實有用?!?!python sqlite fetchall沒有返回正確的數據類型
con = sqlite3.connect('test.db', detect_types=sqlite3.PARSE_DECLTYPES)
與CON:
cur = con.cursor()
cur.execute("SELECT df1 FROM PLCValues")
rows = cur.fetchall()
#print(rows)
for row in rows:
print (row)
print(row)
返回
================= RESTART: C:/Users/zippo/Desktop/Graphit.py =================
(44.64769744873047,)
(44.691650390625,)
(44.691650390625,)
(44.471900939941406,)
(44.64769744873047,)
FETCHONE
con = sqlite3.connect('test.db', detect_types=sqlite3.PARSE_DECLTYPES)
與CON:
cur = con.cursor()
cur.execute("SELECT df1 FROM PLCValues")
rows = cur.fetchone()
#print(rows)
for row in rows:
print (row)
print(row)
返回:
================= RESTART: C:/Users/zippo/Desktop/Graphit.py =================
44.64769744873047
44.64769744873047
「PLCValues」表中「df1」列的類型是什麼? –