寻求有关更新 mysql 表多个文件的帮助。正在运行以下命令并出现错误。谁可以帮我这个事。正在从字典的值更新表。见以下代码
cols = change_dict.keys()
vals = change_dict.values()
conn = MySQLdb.connect(host = "0.0.0.0",user="test",passwd="test",db='maint')
x = conn.cursor()
sql = "update details set %s = '%s' where maint_id=%s" % ( ",".join(cols), ",".join((vals)),id)
print sql
x.execute(sql)
conn.commit()