python遇到SyntaxError: Non-ASCII character '\xc3' in file pic2char.py on line 4, but coding declared;
来源:互联网 发布:淘宝旗舰店和工厂店铺 编辑:程序博客网 时间:2024/05/30 02:52
学习python,遇到以下问题:
SyntaxError: Non-ASCII character '\xc3' in file pic2char.py on line 4, but
coding declared; see http://www.python.org/peps/pep-0263.html for details
通过查阅资料,产生该问题的原因:
python 的默认编码文件是ACSII,而编辑器将文件保存为UTF-8格式的,只要文件中存在中文,就会产生该问题。
解决方法:
在源代码第一行加入
# -*-coding:UTF-8 -*-
或者
#coding=utf-8
0 0
- python遇到SyntaxError: Non-ASCII character '\xc3' in file pic2char.py on line 4, but coding declared;
- python出现SyntaxError: Non-ASCII character '\xe6' in file 打印日期.py on line 1, but no encoding declared;
- python出现SyntaxError: Non-ASCII character '\xe6' in file 打印日期.py on line 1, but no encoding declared
- python出现SyntaxError: Non-ASCII character '\xe6' in file 打印日期.py on line 1, but no encoding declared;
- SyntaxError: Non-ASCII character '\xe8' in file model.py on line 300, but no encoding declared; 报错
- SyntaxError: Non-ASCII character '***' in file *** on line **,but no encoding declared;
- Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared
- python问题Non-ASCII character '\xe5' in file Apriori.py on line 1, but no encoding declared 解决办法
- python问题Non-ASCII character '\xe5' in file Apriori.py on line 1, but no encoding declared 解决办法
- Non-ASCII character '\xb3' in file e:\python\ship.py on line 6, but no encoding declared;
- python出现中文错误:SyntaxError: Non-ASCII character '\xe7' in file car-training.py on line 7, but no encod
- 解决File "temp.py", line 10 SyntaxError: Non-ASCII character '\xe5' in file temp.py on line 10, but no
- SyntaxError: Non-ASCII character '\xe5' in file H:\workspace\output\out\out.py on line 4, but no enc
- SyntaxError: Non-ASCII character '\xef' in file deinstall_mysql_5.7.py on line 8, but no encoding de
- 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding
- 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding
- [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no enc
- 运行python程序时出现错误“SyntaxError: Non-ASCII character '\xe8' in file variable.py on line 1, but no encod”
- iOS AutoLayout: 关联 Xib 和 UIView
- python3学习记录——安装pyspider中lxml安装问题
- Hibernate 主键生成策略
- android拍摄照片和从相册里选择照片
- 如何在linux系统中设置静态ip地址
- python遇到SyntaxError: Non-ASCII character '\xc3' in file pic2char.py on line 4, but coding declared;
- 树的基本概念
- 匿名内部类访问外部类中的局部变量必须是final属性
- IEEE 802.15.4协议完整中文版 - 4.1 通用描述
- @Repository、@Service、@Controller 和 @Component
- ACM 数论 HDU 2608 0 or 1 规律!
- linux总线对象bus_type
- poj2506Tiling
- 博客第一篇:C语言处理动态数组