【发布时间】:2018-10-01 10:47:51
【问题描述】:
我有一个数据库,每分钟插入一个新值,我想每分钟连续获取最新插入的值
cursor = connection.cursor ()
cursor.execute ("select time from gbp_inr_min order by id desc limit 1")
while True:
row = cursor.fetchone
print (row)
time.sleep(60)
connection.close ()
sys.exit()
每当我运行此代码时,它会在一开始就给出正确的输出,之后它只会显示NONE
【问题讨论】:
-
row等于Cursor.fetchone方法,我想应该调用它来获取像row = cursor.fetchone()这样的行