【编码格式错误】SyntaxError: Non-UTF-8 code starting with
问题:
SyntaxError: Non-UTF-8 code starting with '\xba' in file E:/placement/placement/Placement Test/clTest.py on line 6, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

运行结果:

原因:编码格式不对
解决办法:
把相应Python程序文件的编码转成UTF-8格式
1、在文件第一行添加# encoding:utf-8

运行结果:
2.在文件第一行添加# -*- coding: gbk -*-

【编码格式错误】SyntaxError: Non-UTF-8 code starting with的更多相关文章
- SyntaxError: Non-UTF-8 code starting with '\xba' in file 错误的解决方法!!
第一次在Eclipse建立python工程,添加了自己新建的文件,写了一点代码,随后执行时候出现了错误,和昨天我在Visual Studio 2015里面一样,错误: SyntaxError: Non ...
- 怎么解决syntaxerror:non-utf-8 code starting with \xc4'in file
怎么解决syntaxerror:non-utf-8 code starting with \xc4'in file 首行增加,已测试可用. # coding=gbk 程序中出现中文,运行的时候 ...
- 运行python文件时出错SyntaxError: Non-UTF-8 code starting with '\xb5' in file, but no encoding declared;
今天ytkah在运行python文件时出现错误,提示如下,很明显这是没有定义python文件编码引起的问题,那么要怎么解决呢?很简单,在文件头部定义一下就可以了. File "hello.p ...
- SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for
用charles抓包时, 对抓到的html,放到pycharm中解析, 结果报错: SyntaxError: Non-UTF-8 code starting with '\xe5' in file * ...
- 解决Python代码编码问题 SyntaxError: Non-UTF-8 code starting with '\xc1'
本文转载自:http://blog.csdn.net/wyb_hardworking/article/details/19562971 程序中出现中文,运行的时候出现如下错误: SyntaxError ...
- SyntaxError: Non-UTF-8 code starting with '\xc1'
问题描述: 运行Python脚本,报错了:SyntaxError: Non-UTF-8 code starting with '\xc1' 不是不支持中文,是脚本的编码格式设置不正确. 在python ...
- python--遇到SyntaxError: Non-UTF-8 code starting with '\xb8' in file
在运行python中因为添加了中文注释,遇到SyntaxError: Non-UTF-8 code starting with '\xb8' in file 经过百度,说是Python的默认编码格式是 ...
- SyntaxError: Non-UTF-8 code starting with '\xbb' in file D:\流畅学python\ex32.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
1. 报错如下: SyntaxError: Non-UTF-8 code starting with '\xd3' in file D:\流畅学python\ex34.py on line 4, bu ...
- pyinstaller使用错误 SyntaxError: Non-UTF-8 code starting with '\xb4' in file C:......
注:我的博客原本在CSDN,现转到博客园,图片采用以前的图片,并没有盗图. 在将.py文件打包时,出现了下列错误 >>C:\Users\小呆\PycharmProjects\pycha ...
随机推荐
- Django day05 视图层之 (HttpRequest) \ (HttpResponse) \ (JsonResponse) 对象
一:视图层之HttpRequest对象 # 前台Post传过来的数据,包装到POST字典中 # request.POST # 前台浏览器窗口里携带的数据,包装到GET字典中 # request.GET ...
- Python 30 网络编程介绍
1.目标:编写一个C/S架构的软件 C/S:Client --------------- 基于网络 ------------------- Server B/S:Browser ---------- ...
- java 实现yaml 数据转json与map
首先引入snakeyaml-1.16.jar的包. 直接上代码: package com.ming.yaml; import java.util.Map; import org.yaml.snakey ...
- C#中通过js实现个人用户和非个人用户的登陆
实现用户的登录功能,这里举一个个人和非个人用户的登录的例子 前台代码: <ul class="login_list clearfix"> <li> < ...
- Django学习案例一(blog):二. 连接数据库
本例使用了django默认的sqlite3数据库,配置文件不需要作调整: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite ...
- Ionic3 环境搭建以及基础配置实现(更新中)
GitHub:https://github.com/Teloi 环境配置输入以下命令安装 Ionic (如果刚才设置了淘宝镜像源,可以使用 cnpm 代替 npm):npm install -g io ...
- 联想笋尖S90(S90-t 、S90-u)解锁BootLoader
工具下载链接: http://pan.baidu.com/s/1eSgZuka 备用下载链接: http://pan.baidu.com/s/1dFKqSId 本篇教程,仅限于联想笋尖S90(S90- ...
- DeltaFish 校园物资共享平台 第二次小组会议
软工第二周小组会议 会议地点:三教讨论区 会议时间:9:00 ~ 10:00 与会人员:软工小组成员 请假人员:刘鼎乾 整理人:艾寅中 会议记录 一.小组分工 在经过一周的调研后,组长根据调研结果和对 ...
- SQL Server对数据进行删除
SQL Server对数据进行删除,把页面的信息从数据库删除. auto"> <tr style="background:red"> <td> ...
- 用VS Code Debug Python