使用python3从sqlite3数据库中获取数据时出错

时间:2017-04-14 12:10:45

标签: python sql python-3.x sqlite

我试图从sqlite数据库中获取数据,但我收到了错误消息。

代码:

self.con = sqlite3.connect("config.db")
self.cur = self.con.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS config (PCFolder TEXT, ServerFolder TEXT)")
self.con.commit()
dpop = input("Dir path on the PC->") #dpop means "dir path on pc"
dpos = input("Dir path on the server->")
self.cur.execute("INSERT INTO config VALUES (?, ?)", (dpop, dpos))
self.con.commit()
self.cur.execute("SELECT * FROM config WHERE PCFolder=?", (dpop))
name = cur.fetchall()
print(name)

终端

self.cur.execute("SELECT * FROM config WHERE PCFolder=?", (dpop))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The 
current statement uses 1, and there are 11 supplied.

0 个答案:

没有答案