0
我试图从整数列表创建SQLite中一列,但出现以下错误:如何从列表添加到数据库?
"sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied."
这里是我的代码:
conn = sq.connect('test.db')
c = conn.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS table(listItem VALUE)')
def data_entry():
x = 0
list1 = [61,33,4,5]
n = [l for l in list1]
while x < len(list1):
listItem = n
c.execute("INSERT INTO tell(listItem) VALUES (?)",
(listItem))
x += 1
conn.commit()
create_table()
data_entry()
c.close()
conn.close()
提前感谢! :)
这样做的伎俩 - 非常感谢你! :) –