python3使用pymysql操作数据库时字符串中含有单双引号(""/'')的问题

错误信息

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 \'fas好",\'wozhidaole知道了\'" where title = "好"\' at line 1')

解决办法:操作之前多加一步转化

pymysql.escape_string(str)

 



posted on 2019-11-06 14:02  零度风格  阅读(4391)  评论(0编辑  收藏  举报

导航