SyntaxError: Non-UTF-8 code starting with ‘\xc7‘ in file

简介: 学习SyntaxError: Non-UTF-8 code starting with ‘\xc7‘ in file。

解决python编码错误问题

错误原因: 是 xxx.py文件里有中文字符

改正方法:文件的第一行 加上 # coding=gbk

# coding=gbk
# @Time     : 2022/6/7 15:35
# @Author   : hyh
# @File     : test06-1.py
# @Software : PyCharm
name = input("请输入你的姓名:")
print("你的姓名是:%s"%name)
1
2
3
4
5
6
7
8
9



相关文章
|
5月前
|
编解码 程序员 开发者
【Python】已解决:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa1 in position 0: invalid start by
【Python】已解决:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xa1 in position 0: invalid start by
3927 0
|
7月前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
|
Android开发
Failed to obtain GLES 2.x extensions striProcess finished with exit code -1073741819 (0xC0000005)
android studio打开虚拟机时报错信息,解决办法之一(我成功的办法,其他方法试了没用), 打开 设备管理器然后找到你的独显,然后禁用设备,然后再次启动设备就行了,最后再启动你的虚拟机就行了。
172 0
Dx unsupported class file version 52.0 Conversion to Dalvik format failed with error 1
Dx unsupported class file version 52.0 Conversion to Dalvik format failed with error 1
151 0
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
|
Python
SyntaxError: Non-ASCII character ‘\xe6‘ in file E:/pythondemo/example2.py on line 2, but no encoding
SyntaxError: Non-ASCII character ‘\xe6‘ in file E:/pythondemo/example2.py on line 2, but no encoding
305 0
|
XML 数据格式
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
175 0
SyntaxError: Non-UTF-8 code starting with ‘\xd7‘
SyntaxError: Non-UTF-8 code starting with ‘\xd7‘
213 0
SyntaxError: Non-UTF-8 code starting with ‘\xd7‘
SyntaxError: Non-ASCII character '\xe8' in file lane_detector.py on line 5, but no encoding declared;
在进行编译运行的时候报的错,此错是中文乱码的问题,就算是注释也不行.我们需要指定字符集
成功解决SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa3 in position 15: invalid start
成功解决SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa3 in position 15: invalid start