在python中插入INTO语句在我的数据周围加上引号?

时间:2016-12-09 22:53:05

标签: python sql forms variables insert-into

我对Python缺乏经验。

所以我的代码可以将数据插入到我的SQL表中,但我无法弄清楚为什么它们在进入表时会在名称周围加上引号。

What my table looks like in SQL after using my code to insert Matt Brown

这是我的代码

FirstName = formData["firstName"].value
LastName = formData["lastName"].value 

print ("Content-type: text/html\n")
print()

# Some SQL to insert student
query ="INSERT INTO Students (LastName, FirstName) VALUES (%s, %s);"
print(query)
dbConnect.cur.execute(query, (LastName, FirstName))
dbConnect.conn.commit()

0 个答案:

没有答案