【发布时间】:2018-04-20 08:08:56
【问题描述】:
我在 android 中有一个用于调用日志的 sqlite 数据库虚拟数据,使用从 sqlite master 中选择不同表的查询,我如何使用 python for loop 循环显示每个表中的记录,显示所有列和相应的列标题。这是python代码中的一段:
for table in tables:
cursor.execute("SELECT * FROM %s" % table[0])
rows = cursor.fetchall()
for row in rows:
print row # prints records in the all the tables without column headers
【问题讨论】:
-
这段代码应该可以工作。是吗?