pyhon SyntaxError: Non-ASCII character 'xe8' in file xxx on line xx, but no encoding
Posted jlzt1223
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pyhon SyntaxError: Non-ASCII character 'xe8' in file xxx on line xx, but no encoding相关的知识,希望对你有一定的参考价值。
import math
if __name__ == ‘__main__‘:
name1 = raw_input("请输入您的编号:")
print name1
完整的错误信息如下:
File "D:pythonpythonssrc est.py", line 20
SyntaxError: Non-ASCII character ‘xe8‘ in file D:pythonpythonssrc est.py on line 20, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
缺少编码类型声明:no encoding declared
修改如下:
#encoding:utf-8
import math
if __name__ == ‘__main__‘:
name1 = raw_input("请输入您的编号:")
print name1
以上是关于pyhon SyntaxError: Non-ASCII character 'xe8' in file xxx on line xx, but no encoding的主要内容,如果未能解决你的问题,请参考以下文章