首页 > 代码库 > SyntaxError: Non-ASCII character '\xe5' in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

SyntaxError: Non-ASCII character '\xe5' in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

SyntaxError: Non-ASCII character ‘\xe5‘ in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

 

在文件头部加:

 

#-*-coding:utf-8-*-