mysql executemany批量写入数据

if isinstance(item,MmzItem):
            data = {'xinxi':item['xinxi']}
            xinxia = data['xinxi']
            print(len(xinxia),type(xinxia))
            #print("ffffffffffffff",xinxi[0],xinxi[0][8])
            try:
                con.executemany('insert ignore into xi(zhi,gon,go,gon1,nian2,di2,xue2,jin2,rq2,w2z)values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',xinxia)
            except pymysql.Error as e:
                print(e)
                connect.rollback()
                connect.close()
                sys.exit(0)
            connect.commit()
            connect.close()
            #connect.commit()
            print("保存信息.........................")

 

上一篇:Python多进程线程并发


下一篇:Java获取数据库的列名、列数、标题、类型等信息,ResultSetMetaData的各种方法举例