码迷,mamicode.com
首页 > 其他好文 > 详细

pyhon SyntaxError: Non-ASCII character '\xe8' in file xxx on line xx, but no encoding

时间:2018-07-27 10:47:21      阅读:500      评论:0      收藏:0      [点我收藏+]

标签:输入   sci   NPU   ofo   htm   math   file   raw   erro   

import math

if __name__ == ‘__main__‘:
    name1 = raw_input("请输入您的编号:")
    print name1

完整的错误信息如下:

  File "D:\python\pythons\src\test.py", line 20
SyntaxError: Non-ASCII character ‘\xe8‘ in file D:\python\pythons\src\test.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

标签:输入   sci   NPU   ofo   htm   math   file   raw   erro   

原文地址:https://www.cnblogs.com/JLZT1223/p/9376002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!