猿问

python 询查数据,100张流水表,怎么把每次查到的数据存放进一个list中?

for i in range (0,100):
   sql = "SELECT user_id,total,money,use_money,FROM_UNIXTIME(addtime) FROM xx_account_%s GROUP BY user_id HAVING MAX(addtime) < UNIX_TIMESTAMP('20170629');"%i
#执行SQL
   number = cursor.execute(sql)
   sleep(3)
   row_all = cursor.fetchall()
# print(row_all)
#     list_row = list(row_all)
   print(row_all)

慕粉1001097780
浏览 1443回答 1
1回答

天使之翼死神之镰

用extend进行list连接
随时随地看视频慕课网APP

相关分类

Python
我要回答