- conn = MySQLdb.connect(db="my",user="root",
- passwd="ggg",use_unicode=1, charset=‘utf8‘)
- cursor = conn.cursor()
- query = "insert into ewyu(gg,ff) values(%s , %s)"
- para = ("中国","北京")
- cursor.execute(query,para)
- conn.commit()
- conn.close()
2022-10-10 18:26:07