当前位置:网站首页>Solved syntaxerror: (Unicode error) 'Unicode scape' codec can't decode bytes in position 2-3: truncated
Solved syntaxerror: (Unicode error) 'Unicode scape' codec can't decode bytes in position 2-3: truncated
2022-07-27 10:45:00 【No envy】
resolved SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated
List of articles
Error code
A question raised by a small partner in the fan group (xlrd Library to read Excel Form error ):

Then I copied his code and looked at it to see why :
import xlrd
wb = xlrd.open_workbook("C:\Users\Administrator\Desktop\./TEST.xlsx")
print(wb)
Error message :

File "E:/Python Study /2.py", line 2
wb = xlrd.open_workbook("C:\Users\Administrator\Desktop\./TEST.xlsx")
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Error report translation
Translation of error reporting content :
Grammar mistakes :(unicode error )“UnicodeScape” Codec can't decode location 2-3 Bytes in : truncation \uxxxxxxx escape
Error reason
Error reason : stay Python in \ It's the escape sign ,\u Indicates that it is followed by UNICODE code , therefore \User I will report a mistake here .
resolvent
resolvent 1: Precede the string with r(rawstring Native string ), You can avoid python Conflict with regular expression syntax !
import xlrd
wb = xlrd.open_workbook(r"C:\Users\Administrator\Desktop\./TEST.xlsx")
print(wb)
resolvent 2: Every \ Add another one in front \ To signify an escape , The slash can be expressed normally
import xlrd
wb = xlrd.open_workbook("C:\\Users\\Administrator\\Desktop\\./TEST.xlsx")
print(wb)
边栏推荐
- Ubuntu and MySQL quick start tutorial
- Matlab low-level source code realizes the median filtering of the image (used to eliminate some miscellaneous points on the image)
- 7z usage
- 【Liunx】安装MySQL
- JVM -- Analysis of bytecode
- Gamer questions
- Oracle 11g manual memory management
- Matlab- draw bifurcation and chaotic bifurcation diagrams
- [Linux] install redis
- 已解决SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 2-3: truncated
猜你喜欢

PyQt5快速开发与实战 4.2 QWidget
[email protected]@eslint-loader/index.js)解决方法"/>Eslint的报错信息Module Error (from ./node_modules/[email protected]@eslint-loader/index.js)解决方法

flask_restful中的输出域(Resource、fields、marshal、marshal_with)

Kgdb debug kernel cannot execute breakpoints and kdb-22:permisson denied

Tcp/ip protocol

PHP generates text and image watermarks

颜值爆表!推荐两款JSON可视化工具,配合Swagger使用真香

Redis数据结构分析(二)
![[Flink] Flink builds clusters in standalone mode](/img/5b/e566fdd2792b5cda7d37d308ee32e2.png)
[Flink] Flink builds clusters in standalone mode

服务器访问速度
随机推荐
Different binary conversion of MATLAB
Beijing publicized the spot check of 8 batches of children's shoes, and qierte was listed as unqualified
It is thought-provoking: is syntax really important? Qiu Xipeng group proposed a powerful baseline for aspect based emotional analysis
让人深思:句法真的重要吗?邱锡鹏组提出一种基于Aspect的情感分析的强大基线...
[Select] how to write PHP code perfectly?
让人深思:句法真的重要吗?邱锡鹏组提出一种基于Aspect的情感分析的强大基线...
Redis数据结构分析(二)
kgdb调试内核无法执行断点及kdb-22:Permisson denied
Sound processing - Mel frequency cepstrum coefficient (MFCC)
mount.nfs: access denied by server while mounting解决
Matlab/simulink sample sharing for solving differential equations
Solve oracle-ora-01122 01110 01210
Sorting out some open source projects of speech recognition
mount. Nfs: access denied by server while mounting
基于Spark封装的二次开发工程edata-base,介绍
Program translation and execution, from editing, preprocessing, compilation, assembly, linking to execution
Openldap custom schema
TensorFlow笔记——基本函数及概念
A brief introduction to R language pipeline symbols (% >%) and placeholders (.)
Basic statement of database operation