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()
提前感謝! :)
這樣做的伎倆 - 非常感謝你! :) –