我正在尝试使用 python 中的 win32com 模块将 excel 工作表转换为 sqlite3 db。我的 excel 表有 6 列,所以我的 python 代码的一部分是:
for row in exceldata:
c.execute('INSERT INTO exceltable1 VALUES(?,?,?,?,?,?)',row)
conn.commit()
但是python给了我以下错误:
c.execute('INSERT INTO exceltable VALUES(?,?,?,?,?,?)',row)
ProgrammingError: Incorrect number of bindings supplied. The current statement uses 6, and there are 5 supplied.
如果我尝试删除一个问号并再次运行它,则错误现在变为:
c.execute('INSERT INTO exceltable1 VALUES(?,?,?,?,?)',row)
OperationalError: table exceltable1 has 6 columns but 5 values were supplied
任何人都可以向我解释这里发生了什么,如果有任何解决方案......
谢谢。