Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared


        使用网上某个python程序。编译时报错:

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

        原因是缺少编码类型声明:no encoding declared

        段首加入一行声明就可以:

        #encoding:utf-8

posted on 2017-06-15 12:06  slgkaifa  阅读(426)  评论(0编辑  收藏  举报

导航