stephen@ubuntu:~/qichacha$ python3 qichacha.py
Traceback (most recent call last):
File "qichacha.py", line 286, in <module>
qichacha().read_data()
File "qichacha.py", line 71, in read_data
str = f.read()
File "/usr/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
应该是错误的用txt保存了含有bom的内容。
方法一:
打开网页,复制内容,贴到设定好编码为utf-8的notepad++里面试试。
方法二:
使用心的str进行操作