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)



猜你喜欢

转载自www.cnblogs.com/542684416-qq/p/11804781.html
今日推荐