python将字符串插入表中避免单双引号问题

调用pymysql.escape_string("向数据库插入的数据")

 

例如:

import pymysql

str = "as"sdf"

print(pymysql.escape_string(str))