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

2023-07-31,,

=================================版权声明=================================

版权声明:原创文章 谢绝转载 

请通过右侧公告中的“联系邮箱(wlsandwho@foxmail.com)”联系我

勿用于学术性引用。

勿用于商业出版、商业印刷、商业引用以及其他商业用途。                

本文不定期修正完善。

本文链接:http://www.cnblogs.com/wlsandwho/p/8521785.html

耻辱墙:http://www.cnblogs.com/wlsandwho/p/4206472.html

=======================================================================

"C:\Program Files\Python36-32\python.exe" C:/PythonResearch/NaiveBayes/Test_bayes.py
Traceback (most recent call last):
  File "C:/PythonResearch/NaiveBayes/Test_bayes.py", line 77, in <module>
    emailText=open('email\\ham\\23.txt','r').read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 199: illegal multibyte sequence

Process finished with exit code 1

解决问题很简单,把文件用记事本打开,然后另存为,下面编码选ANSI就好。

UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 199: illegal multibyte sequence的相关教程结束。

《UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 199: illegal multibyte sequence.doc》

下载本文的Word格式文档,以方便收藏与打印。