SyntaxError: Non-ASCII character #-*- coding:utf-8 -*-

执行python报错
/usr/bin/python2.7 /root/demo.py
File "/root/demo.py", line 2
SyntaxError: Non-ASCII character '\xe5' in file /root/demo.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Process finished with exit code 1

在程序第一行添加

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

posted @ 2020-08-07 16:12  独孤风  阅读(198)  评论(0编辑  收藏  举报