调用pyMysqL.escape_string('向数据库插入的数据')
例如:
import pyMysqL
str = 'as"sdf'
print(pyMysqL.escape_string(str))