我想我是个傻瓜,也许没有导入正确的包,但是当我这样做时......
from pysqlite2 import dbapi2 as sqlite
import types
import re
import sys
...
def create_asgn(self):
stmt = "CREATE TABLE ? (login CHAR(8) PRIMARY KEY NOT NULL, grade INTEGER NOT NULL)"
stmt2 = "insert into asgn values ('?', ?)"
self.cursor.execute(stmt, (sys.argv[2],))
self.cursor.execute(stmt2, [sys.argv[2], sys.argv[3]])
...
我收到错误 pysqlite2.dbapi2.OperationalError: near "?": syntax error
这对我来说意义不大,因为文档显示 pysqlite 是 qmark 参数化的。不过,我是 python 和 db-api 的新手,请帮帮我!谢谢