📜  sqlite3.ProgrammingError:提供的绑定数量不正确.当前语句使用 1,提供了 7 个. - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:47.921000             🧑  作者: Mango

代码示例1
#Whats happening is that instead of getting the 1 datatype its looking for, 
#SQLite thinks its getting multiple. To solve this pass the data through as a 
#tuple, not on its own
cursor.execute('INSERT INTO images VALUES(?)', (data)) #should be
cursor.execute('INSERT INTO images VALUES(?)', (data,))
#To demonstrate, print the lengths of both of the options:
len(data)
>>>7
len(data,)
>>>1