【发布时间】:2019-12-29 01:16:06
【问题描述】:
我在 CentOS 中使用 Python,我正在编写一个简单的代码来将 Python 链接到 MYSQL。我的问题是我想自动增加 id 列。我使用 CentOS 终端。
我试着写这个,所以程序会自动增加 id 列,因为我在一些答案中看到了它
record = [12,'tom']
cursor.execute("insert into t3(number,sent)values(%s,%s),record)
它给了我错误
<module> cursor.execute("insert into t3(number,sent)values(%s,%s)",record)
NameError :name 'cursor' is not defined
所以请大家这是我第一次遇到堆栈溢出,我希望能找到好的答案。 :(
【问题讨论】: