当前位置: 首页 > 工具软件 > pinyin.py > 使用案例 >

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

竺国兴
2023-12-01


        使用网上某个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

 类似资料: