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

  

解决方法: #!/usr/bin/python
 #-*-coding:utf-8-*-

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

时间: 2024-09-28 15:58:17

SyntaxError: Non-ASCII character '\xe7' in file 9.py on line 13, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details的相关文章

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

python的默认编码文件是用的ASCII码,而你的python文件中使用了中文等非英语字符. 在Python源文件的最开始一行,加入一句: # coding=UTF-8 SyntaxError: Non-ASCII character '\xe5' in file test.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details 原文地址:https://w

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

SyntaxError: Non-ASCII character '\xe5' in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details 在文件头部加: #-*-coding:utf-8-*- SyntaxError: Non-ASCII character '\xe5' in file a.py on line 9, but no enco

[已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

想在python代码中输出汉字.但是老是出现SyntaxError: Non-ASCII character '\xe4' in file test.py on line , but no encoding declared. (test.py是我自己的文件,提示错误出现在第4行, 你的文件也会得到相应的提示). 一个简单的示例test.py代码如下: 1 #!/usr/bin/python 2 3 print "你好吗" 在终端下执行python test.py指令之后, File

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 段首添加一行声明即可:

python - 中文打印报错SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。

python中默认的编码格式是ASCII格式, 所以在没修改编码格式时无法正确打印汉字. 解决办法: 在以后的每一个需要显示汉字的python文件中, 可以采用如下方法在 #!/usr/bin/python的下一行加上一句话来定义编码格式, 以utf-8编码为例: #!/usr/bin/python#coding:utf-8 特别注意:定义编码格式的这一行代码必须放在第一行或者第二行,一般如果第一行是提示python位置的代码, 那么定义编码格式的这一行就必须放在第二行,否则依然会提示错误. p

python出现Non-ASCII character '\xe7' in file ex6.py on line 1, but no encoding declare错误

http://www.cnblogs.com/qi09/archive/2012/02/06/2340712.html python中出现Non-ASCII character '\xe7' in file ex6.py on line 1, but no encoding declare的错误 可按照错误建议网址查看http://www.python.org/peps/pep-0263.html 发现是因为Python在默认状态下不支持源文件中的编码所致.解决方案有如下三种: 一.在文件头部添

python问题:SyntaxError:Non-ASCII character '\xe5' in file kNN.py on line 2, but no encoding declared;

因为Python在默认状态下不支持源文件中的编码所致.解决方案有如下三种: 一.在文件头部添加如下注释码: # coding=<encoding name> 例如,可添加# coding=utf-8 二.在文件头部添加如下两行注释码: #!/usr/bin/python # -*- coding: <encoding name> -*- 例如,可添加# -*- coding: utf-8 -*- 三.在文件头部添加如下两行注释码: #!/usr/bin/python # vim:

python2.7报错Non-ASCII character &#39;\xe5&#39; in file knn.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Python默认是以ASCII作为编码方式的,如果在自己的Python源码中包含了中文(或者其他非英语系的语言),此时即使你把自己编写的Python源文件以UTF-8格式保存了,但实际上,这依然是不行的. 解决办法很简单,只要在文件开头加入下面代码就行了 # -*- coding: UTF-8 -*- python2.7报错Non-ASCII character '\xe5' in file knn.py on line 3, but no encoding declared; see http

SyntaxError: Non-UTF-8 code starting with &#39;\xb5&#39; in file test.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

使用editplue运行如下程序,出现错误 hex_value1 = 0x13print("hex_value1的值为:",hex_value1) SyntaxError: Non-UTF-8 code starting with '\xb5' in file test.py on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 转载: Eclipse+PyDe