for date in c.fetchone():
[('date')]
print date
上图:
^{pr2}$for date in c.fetchmany(2):
[('date')]
print date
上图:
(u'02/27/2017',)
(u'02/27/2017',)
不知道为什么它返回值u'xxx,),因为它现在将它打印为一个表?在
总之,我想把这两个值(行)保存在两个不同的变量中,以便最终与其他变量进行比较。在
for date in c.fetchmany(2):
[('date')]
print date
for row in date:
print row[0], row[1]
上述结果将导致:
(u'02/27/2017',)
0 2
(u'02/27/2017',)
0 2
但我希望它能打印:
(u'02/27/2017',)
02/27/2017
(u'02/27/2017',)
02/27/2017
for date in c.fetchmany(2):
[('date')]
print date
for row in date:
print row[0]
(u'02/27/2017',)
0
(u'02/27/2017',)
0
不知道怎么解决这个问题。谁能给我指出正确的方向吗?在
谢谢。在
您可以像这样获取每个元组的第一个元素:
相关问题 更多 >
编程相关推荐