0
点赞
收藏
分享

微信扫一扫

python 元组转列表 列表分组,再组合

import pymysql,itertools
connect = pymysql.connect(
user = 'm',
password = '0',
db = 'x',
host = 'r',
port = 3306,
charset = 'utf8'
)
con =connect.cursor()
sql="select bm from bm51 where bzz='0'"
con.execute(sql)
connect.commit()
sha=con.fetchall()
shaa=list(itertools.chain(*sha))
shaaa=[shaa[x:x+5] for x in range(0,410,5)]
for i in shaaa:
ii="%".join(i)
print(ii)

for av in i:
con.execute("update bm51 set bzz='1' where bm=(%s)",(av))
connect.commit()





举报

相关推荐

python翻转列表

Python ❀ 列表与元组

列表,元组

Python 列表 元组 集合 字典

python的列表,元组,字典

0 条评论