小编Vex*_*ior的帖子

sqlite3.InterfaceError:绑定参数0时出错 - 可能是不支持的类型?

尝试将数据从 Python(3.9.1) 编译到 SQLite3 时出现错误。

import sqlite3

conn = sqlite3.connect('newdB.db')

#Creates the table 'tbl_newdb' with an incrementing ID, and 'db_type' columns.
with conn:
    cur = conn.cursor()
    cur.execute("CREATE TABLE IF NOT EXISTS tbl_newdb( \
        ID INTEGER PRIMARY KEY AUTOINCREMENT, \
        db_type TEXT)")
    conn.commit()
conn.close()

conn = sqlite3.connect('newdB.db')

#Our list of data we will be grabbing from to fill the tables.
with conn:
    cur = conn.cursor()
    fileList = "information.docx","Hello.txt","myImage.png","myMovie.mpg","World.txt","data.pdf","myPhoto.jpg"
    cur.execute("INSERT INTO tbl_newdb (db_type) VALUES (?)",(fileList,))
    conn.commit()
conn.close()
Run Code Online (Sandbox Code Playgroud)

这是我从 IDLE shell 收到的错误消息:

 line …
Run Code Online (Sandbox Code Playgroud)

python sql database sqlite

2
推荐指数
1
解决办法
6546
查看次数

标签 统计

database ×1

python ×1

sql ×1

sqlite ×1