【发布时间】:2013-12-11 07:01:52
【问题描述】:
我正在尝试将 None 值插入到我的数据库的行条目中。表present存在
db.execute("INSERT INTO present VALUES('test', ?, 9)", "This is a test!")
db.execute("INSERT INTO present VALUES('test2', ?, 10)", None)
但我得到一个错误:
ValueError: parameters are of unsupported type
如何为行中的第二个字段插入空白值?
【问题讨论】:
-
你试过 NULL 吗?
-
@opalenzuela 传递 'NULL' 作为字符串而不是 None 对我有用。
标签: python sqlite sql-insert