考虑下面的代码
Table="USER"
fields="("+'username'+")"
values=('vishnu',)
dbcon = MySQLdb.connect(...)
insert_query="insert into %s%s values%%s"%(Table,fields)
cursor=dbcon.cursor()
cursor.execute(insert_query,(values,))
cursor.close()
dbcon.commit()
对于两个系统,此代码的工作方式不同。在我的笔记本电脑,它工作得很好,但在我的桌面上,它显示MYSQL语法错误。你知道吗
我不能解决这个问题?原因是什么,我使用的是相同版本的python2.7。你知道吗
问题在于MySQLdb版本
这是由于MySQLdb版本的不同。尝试使用相同版本的MySQLdb。你知道吗
相关问题 更多 >
编程相关推荐