UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 0: illegal multibyte sequence

目录

    混淆了 python2 里边的 str 和 unicode 数据类型。 

    1. 
    对需要 str->unicode 的代码,可以在前边写上 
    import sys 
    reload(sys) 
    sys.setdefaultencoding('utf8') 
    把 str 编码由 ascii 改为 utf8 (或 gb18030) 

    2. 
    python3 区分了 unicode str 和 byte arrary,并且默认编码不再是 ascii 

    posted @   bigbigtree  阅读(24438)  评论(0编辑  收藏  举报
    点击右上角即可分享
    微信分享提示