【编码格式错误】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 ...
随机推荐
- android 可拖动控件 ontouchevent
首先附上文章的转载内容的链接: 学习android 可拖动事件首先需要对android的屏幕和touchevent参数建立一个详细的知识结构. 1.android坐标系统 一.首先明确一下 andro ...
- elasticsearch模板 template
https://elasticsearch.cn/article/335 elasticsearch模板 template 可以考虑的学习点: mapping的 _default_类型 动态模板:dy ...
- Oracle 数据导入导出(imp/exp)
环境:windows下,oracle11g 1.启动oracle服务 net start OracleDBConsoleorclnet start OracleOraDb11g_home1TNSLis ...
- 网站html代码解析
1.什么是HTML文件?HTML中文叫做“超文本标记语言”,一个HTML文件不仅包含文本内容,还包含一些标记,一个HTML文件的后缀名是.htm或者是.html.用文本编辑器(Dreamweaver) ...
- python--3、函数
定义: 定义函数时,也相当于定义变量.会把函数体内的代码存入开辟的内存空间中.使用函数时,通过func() 声明是函数,其对应的值为代码.函数是指将一组语句的集合通过一个名字(函数名)封装起来,要想执 ...
- kotlin第一个项目的搭建
怎么在Android Studio中使用Kotlin? 1.使用Android Studio的插件 2.将Android Studio升级到3.0版本:目前不推荐,因为3.0的版本目前还是Dev Ch ...
- C++版的LLC代码
图像稀疏编码总结:LLC和SCSPM,文章对稀疏编码讲解非常详细. <Locality-constrained Linear Coding for Image Classification> ...
- windows 实时性
在硬件编程时,大部分非智能硬件并没有主动通知反馈功能,需要PC主动轮询状态寄存器去查询硬件状态.对于运动类控制器,查询的时机(间隔)在一定程度上影响着准确率与系统负载.即使不考虑系统负载,在1000H ...
- HDU_1847_基础博弈sg函数
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- CodeForces 356A_(set应用,线段树)
A. Knight Tournament time limit per test 3 seconds memory limit per test 256 megabytes input standar ...