时间:2021-07-01 10:21:17 帮助过:34人阅读
Conn_IP = ""
Conn_UserName = ""
Conn_PassWord = ""
Conn_database = ""
conn = MySQLdb.connect(Conn_IP,Conn_UserName,Conn_PassWord,Conn_database)
cursor = conn.cursor()
val = {"k1":t,"k2":n}
ins_sql = "insert into 表(字段1,字段2) values(%(k1)s,%(k2)s)"
try:
cursor.execute(ins_sql,val)
conn.commit()
except:
conn.rollback()
conn.close()
MySQLdb 操作数据库
标签:pass user 数据 ack data mysqldb int connect 操作