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月前
|
测试技术 C++
【C++】解决googleTest报错error: SEH exception with code 0xc0000005 thrown in the test body.
【C++】解决googleTest报错error: SEH exception with code 0xc0000005 thrown in the test body.
134 1
|
6月前
|
编解码 程序员 开发者
【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
5825 0
|
8月前
|
Unix Linux Shell
syntax error: unexpected end of file
syntax error: unexpected end of file
36 0
|
8月前
|
Python
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
完美解决丨File “invalid.py“, line 1 print(`Hello World!`) ^ SyntaxError: invalid syntax
Newline required at end of file but not found.
Newline required at end of file but not found.
199 0
Newline required at end of file but not found.
|
Android开发
Failed to obtain GLES 2.x extensions striProcess finished with exit code -1073741819 (0xC0000005)
android studio打开虚拟机时报错信息,解决办法之一(我成功的办法,其他方法试了没用), 打开 设备管理器然后找到你的独显,然后禁用设备,然后再次启动设备就行了,最后再启动你的虚拟机就行了。
180 0
Parse error: syntax error, unexpected '<<' (T_SL) in .../test2.php on line 2
Parse error: syntax error, unexpected '<<' (T_SL) in .../test2.php on line 2
184 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
157 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
322 0