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

版权声明:本文为csdn博主[applebite](http://blog.csdn.net/applebite) 原创文章,转载请注明出处,侵权必究。 微信添加公众号:qi_chuang 或 猎奇创新平台

你可能感兴趣的:(python,编码,character)