sqlite插入使用{...}和?同时

时间:2018-10-15 18:42:51

标签: python sqlite syntax

我必须遵循以下代码:

temp = item.get() #returns a string
c.execute("INSERT OR IGNORE INTO {tn} ({cn}, {dn}, {en}) VALUES (?, 23, 10)".\
format(tn=table_name, cn=field2, dn = field3, en = field4), (temp))

但是,代码会导致错误:

File "First_GUI.py", line 47, in func_confirm
format(tn=table_name, cn=field2, dn = field3, en = field4), (temp))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current 
statement uses 1, and there are 0 supplied.

您是否知道如何修复语法?

0 个答案:

没有答案