admin管理员组

文章数量:1612065

解决‘gbk‘ codec can‘t decode byte 0xaf in position 81: illegal multibyte sequence

    • 错误描述:
    • 错误原因:
    • 解决办法:

错误描述:

具体报错内容忘记截图了,主要的报错信息如下

报错:‘gbk‘ codec can‘t decode byte 0xaf in position 81: illegal multibyte sequence
gbk编码器不能解析位于81中字节0xaf:非法多比特序列

错误原因:

显然是文件的编码和解码的格式不一致

解决办法:

在open函数后面添加encoding='utf-8'

本文标签: bytexafDecodegbkCodec