标签:imp mys tco tab code span roo class 批量插入
import mysql.connector conn= mysql.connector.Connect( host=‘localhost‘, user=‘root‘, passwd=‘admin‘, database=‘testcode‘ ) print(‘1.‘,conn) cmd = conn.cursor() # 光标行 ssql=‘insert into test(sname,age)values(%s,%s)‘ name=[(‘susu1‘,11),(‘susu2‘,12),(‘susu3‘,13),(‘susu4‘,14),(‘susu5‘,15),(‘susu6‘,16),(‘susu7‘,17),(‘susu8‘,18)] cmd.executemany(ssql,name) conn.commit() print(‘4.‘,cmd.rowcount,‘条记录插入成功‘)
标签:imp mys tco tab code span roo class 批量插入
原文地址:https://www.cnblogs.com/cy-zjs/p/13509524.html