PythonCodesql="INSERTINTOtest(keyword,content)values(\"%s\",\"%s\")"%(keyword,content)cur.execute(sql)报错信息File"D:\Personal\Common.py",line72,inDataIntoDBcur.execute(sql)File"D:\Python\V2.7\lib\site-packages\MySQLdb\cursors.py",line157,inexecutequery=query.encode(charset)UnicodeEncodeError:'gbk'codeccan'tencodecharacteru'\u2027'inposition185:illegalmultibytesequence参考文章Python字符编码详解Python当前的默认编码设置setdefaultencodingPython中如何处理UnicodeDecodeError和UnicodeEncodeErrorPython2.x中常见字符编码和解码方面的错误及其解决办法Python中字符编码的总结和对比:Python2.x的str和unicodevsPython3.x的bytes和str
幕布斯7119047
相关分类