Python-sqlite3.ProgrammingError:提供的绑定数量不正确。当前语句使用1,并且提供了74
发布于 2021-02-02 23:17:35
def insert(array):
connection=sqlite3.connect('images.db')
cursor=connection.cursor()
cnt=0
while cnt != len(array):
img = array[cnt]
print(array[cnt])
cursor.execute('INSERT INTO images VALUES(?)', (img))
cnt+= 1
connection.commit()
connection.close()
我无法弄清楚为什么这会给我错误,我尝试插入的实际字符串长度为74个字符,它是:“ / gifs / epic-fail-photos-there-i-fixed-it-aww-man-the -tire-pressures-low.gif”
在插入它之前,我曾尝试过str(array [cnt])
,但同样的问题也在发生,数据库只有一列,这是一个TEXT值。
我已经待了好几个小时了,无法弄清楚到底发生了什么。
关注者
0
被浏览
89
1 个回答