我正在尝试执行一个sql语句,该语句应该向数据库添加一些数据,如下所示:
cursor.execute("INSERT INTO Actors (imdbPageId, fullName) VALUES (%s, %s)" % ( db.escape_string(self.imdbID), self.name))
我也尝试过:
cursor.execute("INSERT INTO Actors (imdbPageId, fullName) VALUES (%s, %s)" % ( self.imdbID, self.name))
但是不管是否使用escape_string
,我总是会得到这个错误。见下表:
MySQLdb._exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/name/nm0991810, Mahershala Ali)' at line 1")
我很肯定这和正斜杠有关,但我不能让它起作用。如何解决此问题?你知道吗
如果需要更多信息,请告诉我!你知道吗
请改为:
如果我没弄错的话
mysqldb
会帮你处理好的。你知道吗否则您可以:
相关问题 更多 >
编程相关推荐