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,'条记录插入成功')