This commit is contained in:
localvar 2020-01-17 18:34:56 +08:00
parent 71c1dcb236
commit 1177110a02
2 changed files with 2 additions and 2 deletions

View File

@ -583,7 +583,7 @@ data = c1.fetchall()
numOfRows = c1.rowcount numOfRows = c1.rowcount
numOfCols = len(c1.description) numOfCols = len(c1.description)
for irow in range(numOfRows): for irow in range(numOfRows):
print("Row%d: ts=%s, temperature=%d, humidity=%f" %(irow, data[irow][0], data[irow][1],data[irow][2]) print("Row%d: ts=%s, temperature=%d, humidity=%f" %(irow, data[irow][0], data[irow][1],data[irow][2]))
# use the cursor as an iterator to retrieve all returned results # use the cursor as an iterator to retrieve all returned results
c1.execute('select * from tb') c1.execute('select * from tb')

View File

@ -579,7 +579,7 @@ data = c1.fetchall()
numOfRows = c1.rowcount numOfRows = c1.rowcount
numOfCols = len(c1.description) numOfCols = len(c1.description)
for irow in range(numOfRows): for irow in range(numOfRows):
print("Row%d: ts=%s, temperature=%d, humidity=%f" %(irow, data[irow][0], data[irow][1],data[irow][2]) print("Row%d: ts=%s, temperature=%d, humidity=%f" %(irow, data[irow][0], data[irow][1],data[irow][2]))
# 直接使用cursor 循环拉取查询结果 # 直接使用cursor 循环拉取查询结果
c1.execute('select * from tb') c1.execute('select * from tb')