import MySQLdb

#创建链接
conn=MySQLdb.Connect(host='localhost',user='root',passwd='',db="xingming")

#生成游标
cursor=conn.cursor()

#插入多条记录
cursor.executemany(
"""INSERT INTO xm (x, m)
VALUES (%s, %s)
""",
[
(
"h","c"),
(
"g","y")
] )

#查询
count=cursor.execute('select * from xm')
results
= cursor.fetchall()
for r in results:
print r

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-01-01
  • 2021-06-10
  • 2021-04-09
  • 2022-01-13
猜你喜欢
  • 2021-09-24
  • 2021-07-06
  • 2021-09-07
  • 2021-12-20
  • 2021-10-10
  • 2022-12-23
  • 2021-10-10
相关资源
相似解决方案