SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for

用charles抓包时, 对抓到的html,放到pycharm中解析,

结果报错:

SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for

我在开头添加了

# -*- encoding:utf-8 -*- 

之后错误消失, 目前还没搞懂具体原因.