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()
        

 

上一篇:MySQL 8.0配置


下一篇:[Error]在Linux服务器:cannot connect to X server localhost:11.0