python写词云出现的异常解决办法
如果出现这种异常,解决办法就是把txt文件编码方式转换成utf-8Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
== RESTART: C:/Users/Faker/AppData/Local/Programs/Python/Python35/政府报告词云.py ==
Traceback (most recent call last):
File "C:/Users/Faker/AppData/Local/Programs/Python/Python35/政府报告词云.py", line 6, in <module>
t=f.read()
File "C:\Users\Faker\AppData\Local\Programs\Python\Python35\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 0: invalid start byte
>>>
[此贴子已经被作者于2018-8-6 22:52编辑过]