python connector user guide
This commit is contained in:
parent
ccb02180f4
commit
a0b79bd771
|
@ -345,7 +345,7 @@ c1.execute('select * from tb')
|
||||||
data = c1.fetchall()
|
data = c1.fetchall()
|
||||||
# data is a list of returned rows with each row being a tuple
|
# data is a list of returned rows with each row being a tuple
|
||||||
numOfRows = c1.rowcount
|
numOfRows = c1.rowcount
|
||||||
numOfCols = c1.descriptions
|
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])
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ c1.execute('select * from tb')
|
||||||
data = c1.fetchall()
|
data = c1.fetchall()
|
||||||
# 返回的结果是一个列表,每一行构成列表的一个元素
|
# 返回的结果是一个列表,每一行构成列表的一个元素
|
||||||
numOfRows = c1.rowcount
|
numOfRows = c1.rowcount
|
||||||
numOfCols = c1.descriptions
|
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])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue