1、环境:Python3.5
2、在代码最上面也已经添加了“# -- coding: UTF-8 --”
3、问题:
Connected to pydev debugger (build 182.4129.34)
Traceback (most recent call last):
File "D:JetBrainsPyCharm Community Edition 2018.2.2helperspydev_pydevd_bundlepydevd_comm.py", line 382, in _on_run
r = r.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1022-1023: unexpected end of data
因为Python3的字符串无decode()方法了,所以需要先encode()一下,再decode()。如:r=r.encode(XXX).decode(XXX)