问题描述

1
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4575: invalid start byte

解决方案

1
2
3
4
import codecs
with open('pepunit.idlist','r',encoding='unicode-escape') as f:
#或忽略错误
with open('pepunit.idlist','r', encoding='utf-8', errors='ignore') as f:

参考来源

https://www.crifan.com/summary_python_unicodedecode_error_possible_reasons_and_solutions/