c.execute("UPDATE Players SET %s = %d WHERE nick=%s",
(parts[1], int(parts[2]), parts[0]))
私にエラーを与えています
TypeError: %d format: a number is required, not str
のみをexecute
取る必要があることはわかっていますが、int(文字列として入力)になるため、intにキャストする必要があります。%s
parts[2]
したがって、 のみを入力%s
すると、もちろん次のエラーが発生します。
mysql_exceptions.ProgrammingError: (1064,
"You have an error in your SQL syntax; "
"check the manual that corresponds to your MySQL server version "
"for the right syntax to use near "
"''wins' = '450' WHERE nick='xan'' at line 1")
wins
は整数だからです。これに対する解決策は何ですか?