UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2
读取文件时遇到
Traceback (most recent call last):
File "fenci.py", line 21, in <module>
text = open(path.join(d, 'job1000.txt')).read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 73: illegal multibyte sequence
text = open(path.join(d, 'job1000.txt')).read()
改为
text = open(path.join(d, 'job1000.txt'),'rb').read()