Python3 编译中文字串报错解决方案
问题:
Python3.6.5 版本中,程序有中文,运行时出现以下error:
SyntaxError: Non-UTF-8 code starting with '\xb2' in file XXX.py on line 8, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Root cause:
导致出错的根源就是编码问题。
解决方案是:
在程序最上面加上:# coding=gbk
这样程序就可以正常运行了。
解决中文乱码问题在程序最前面:
#encoding=utf-8
#encoding=gb2312
#unicoding=gb2312
尝试以上几种看是否能将问题解决,目前Geany编译器时不时报中文问题,目前是以上方法解决,等熟悉再分享原因
Python3 编译中文字串报错解决方案的更多相关文章
- visual2013 的 MVC 4中连接数据库报错解决方案
win7 64位安装vs2013后连接远程数据库出现下面的问题:A first chance exception of type 'System.AccessViolationException' ...
- Python3.x:关于urllib中urlopen报错问题的解决方案
Python3.x:关于urllib中urlopen报错问题的解决方案 调用:urllib.urlopen(url) 报错:AttributeError: 'module' object has no ...
- python接口自动化:python3.6中import Crypto.Hash报错的解决方案
一:问题 python3.6中算法加密引入包Crypto报错,即便安装了: pip install crypto pip install pycrypto pip install pycryptodo ...
- C语言开发中常见报错的解决方案
C语言开发中常见报错的解决方案 整理来源于网络,侵权请通知删除.*禁止转载 ---- fatal error C1003: error count exceeds number; stopping c ...
- Python3.x:import urllib2报错解决方案
Python:import urllib2报错解决方案 python2和3有些不一样: python2:输出为print 'hello world' python3:输出为print('hello w ...
- python3.4中自定义wsgi函数,make_server函数报错问题
别的不多说,先上代码 #coding:utf-8 from wsgiref.simple_server import make_server def RunServer(environ, start_ ...
- 【maven】【IDEA】idea中使用maven编译项目,报错java: 错误: 找不到符号 【2】
=================================================================================== idea中使用maven编译项目 ...
- Maven编译中使用${env}与直接启动tomcat会报错的问题处理
Maven编译中使用${env}与直接启动tomcat会报错的问题处理 在Run/Debug Configurations中,设置 Before lauch:Build, Build Artifact ...
- python2中的unicode()函数在python3中会报错:
python2中的unicode()函数在python3中会报错:NameError: name 'unicode' is not defined There is no such name in P ...
随机推荐
- Django Web开发指南笔记
Django Web开发指南笔记 语句VS表达式 python代码由表达式和语句组成,由解释器负责执行. 主要区别:表达式是一个值,它的结果一定是一个python对象:如:12,1+2,int('12 ...
- 【分享】自己写的一个可空的DateTimePicker控件-附源码
最近这段时间在重构以前的一个项目,其中有一项就是要把DateTimePicker控件值可空.大家都知道的DateTimePicker值为DateTime类型,DateTime类型值不能等于Null.但 ...
- 九度OJ 1064:反序数 (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3758 解决:2773 题目描述: 设N是一个四位数,它的9倍恰好是其反序数(例如:1234的反序数是4321) 求N的值 输入: 程序无任 ...
- Bootstrap aggregating Bagging 合奏 Ensemble Neural Network
zh.wikipedia.org/wiki/Bagging算法 Bagging算法 (英语:Bootstrap aggregating,引导聚集算法),又称装袋算法,是机器学习领域的一种团体学习算法. ...
- Azkaban_Oozie_action
http://azkaban.github.io/azkaban/docs/2.5/ There is no reason why MySQL was chosen except that it is ...
- php计算数组的维数
function array_dim($arr){ if(!is_array($arr)) return 0; else{ $max1 = 0; foreach($arr as $item1){ $t ...
- Django创建模型_模型层
1.在项目Mysite下创建应用bms 2.在bms下的models.py文件中创建模型 from django.db import models # Create your models here. ...
- 在maven 中部署SSM项目找不 Spring ContextLoaderListener 的解决办法
1.项目使用技术:maven的项目使用了Spring MVC+Spring +Mybatis+Tomcat搭建一个项目. 2.报错信息: Error configuring application l ...
- contenttype应用 , 缓存相关
一. Django的contenttypes contenttypes 是Django内置的一个应用,可以追踪项目中所有 app和model 的对应关系,并记录在 django_content_typ ...
- jQuery/CSS3实现Android Dock效果
在线演示 本地下载