【发布时间】:2013-03-20 01:46:21
【问题描述】:
运行此代码时出现错误:
import sqlite3
user_name = raw_input("Please enter the name: ")
user_email = raw_input("Please enter the email: ")
db = sqlite3.connect("customer")
cursor=db.cursor()
sql = """INSERT INTO customer
(name, email) VALUES (?,?);,
(user_name, user_email)"""
cursor.execute(sql)
为什么会这样?
【问题讨论】:
-
从我在 python 中使用 sqlite3 开始,我记得查询和参数必须是单独的参数,而不是单个字符串。可以试试吗?