我试图在python中打印计数表,我写了这段代码:
count = cur.execute("SELECT COUNT(*) FROM %s;" str(table))
print count
所有打印结果均为1,(认为1 = true),我如何打印sql命令的实际结果?
谢谢
您必须获取结果:
cursor = db.cursor()
count = cursor.execute("SELECT COUNT(*) FROM " + str(table))
db.commit()
print cursor.fetchone()[0]
cursor.close()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句