首页 > 代码库 > python错误: SyntaxError: Non-ASCII character '\xe5' in file /home...

python错误: SyntaxError: Non-ASCII character '\xe5' in file /home...

python中使用中文注释出现错误
 SyntaxError: Non-ASCII character ‘\xe5‘ in file /home...
解决
在文件开头加入:
# -*- coding: UTF-8 -*-    或者  #coding=utf-8

python错误: SyntaxError: Non-ASCII character '\xe5' in file /home...