SyntaxError: Non-UTF-8 code starting with xxx
code with xxx utf Non starting SyntaxError
2023-09-27 14:25:18 时间
问题:
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 -*-
相关文章
- vs code的插件
- SyntaxError: Non-UTF-8 code starting with ‘xe4‘ in file解决办法
- 代码对比软件——code compare
- JavaScript - 根据后端返回的唯一 ID / code,生成 “唯一“ 的推荐码、邀请码、订单号、加密路由、一串英文+数字长字符等 (支持反序列化原 ID 解码,逆向得出 ID 二者互转)
- [qiankun]Uncaught Error application ‘vue2‘ died in status LOADING_SOURCE_CODE [qiankun] You need t
- 【连接】mac使用Microsoft Remote Desktop Beta 远程win Error code: 0x104
- error: SEH exception with code 0xc0000005 thrown in the test
- SAP WM模块的那些常用T-code
- file_get_contents(): SSL operation failed with code 1
- 洛谷 P4059 [Code+#1]找爸爸
- xcode Linker command failed with exit code 1错误
- 报错 - Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lex failed with exit code 1
- IIS OCIEnvCreate failed with return code -1
- Visual Studio Code Debug C++ on Mac
- Convertion of grey code and binary 格雷码和二进制数之间的转换
- IDEA从零到精通(27)之Eclipse Code Formatter插件的安装与使用