批量插入 executemany
conn = pymysql.connect(host=DBParems.sql_host.value,
# port=server.local_bind_port,
user=DBParems.sql_user.value,
passwd=DBParems.sql_password.value,
db=DBParems.sql_db.value)
cur=conn.cursor()
sql = 'insert into hospital(name,age,sex) values(%s,%s,%s)'
col_data = (('pp',12,male),('qq',21,female),('oo',31,male))
cur.executemany(sql,col_data)
cur.commit()
conn.close()