python实践报错:SyntaxError: Non-ASCII character

报错: File "C:\001myWorkspace\001myWork\workspace2\MyFirstPython\src\demo4\demo4-2.py", line 21
SyntaxError: Non-ASCII character '\xe5' in file C:\001myWorkspace\001myWork\workspace2\MyFirstPython\src\demo4\demo4-2.py on line 21, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
如图:

image

分析:SyntaxError: Non-ASCII character 可看出是用于编码格式出问题了

解决方案:

1、在文件第一行添加: # encoding:utf-8

image

 

   好了,本次到此,如果觉得有帮助,需要更多测试相关技术,欢迎来交流,联系方式如下:

 

 

posted @ 2016-02-23 12:51  黑夜小怪  阅读(553)  评论(0编辑  收藏  举报