代码:

sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], actor, Creation_time, p_url)

 

问题是:

pymysql.err.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 'tWe','2018/07/09 09:33','https://piao.damai.cn/155901.html')' at line 1")

原因可能是actor值

   pymysql.err.ProgrammingError: (1064)(字符串转译问题)有引号

 

 

解决方式

pymysql.escape_string()

 

代码:

sql = "insert into dm_copy(演出类型,演出场馆,剧目名称,演出地点,演出时间,演出票价,演出团体,创建时间, url)values('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (category, venue, name, city, showtim, prices[:-1], pymysql.escape_string(actor), Creation_time, p_url)

 

相关文章:

  • 2021-09-15
  • 2021-06-24
  • 2023-03-21
  • 2022-12-23
  • 2021-09-14
  • 2022-02-02
  • 2021-08-24
猜你喜欢
  • 2022-02-18
  • 2022-01-13
  • 2022-01-13
  • 2021-11-03
  • 2021-08-24
  • 2022-01-21
  • 2021-12-09
相关资源
相似解决方案