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

错误信息mysql

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')

解决办法:操做以前多加一步转化sql

pymysql.escape_string(str)
相关文章
相关标签/搜索