运行python脚本报错 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes  in position 2-3: truncated \UXXXXXXXX escape 

 原因: 反斜杠  \   在python3 中属于转义符, 脚本中的路径里包含了反斜杠,反斜杠产生转义效果导致报错

解决方法:在路径前添加  r  ,可以让反斜杠不产生转义效果

运行python脚本报错SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape的更多相关文章

  1. Python报错:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

    运行python文件的时候报错: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2 ...

  2. 报错:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

    Outline SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: trunc ...

  3. Python中出现 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 12-13: truncated \UXXXXXXXX escape

    Python中出现 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 12-13: t ...

  4. SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape错误原因及解决方法

    用Python打开文件: with open('C:\Users\PINPIN\test\file1.txt','r') as f2: pass 运行后直接就报错了: File "<i ...

  5. SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

    "F:\program files (x86)\Python35\python.exe" "F:/program files (x86)/JetBrains/Seleni ...

  6. Python--错误SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

    Refer to:https://www.cnblogs.com/cyiner/archive/2011/09/18/2180729.html 用Python打开文件: fo=open("C ...

  7. Python中读取txt文本出现:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape问题解决

    windows中的路径是反斜杠\,然而反斜杠\在python中有着转义字符的意义,所以在py文件中写windows文件路径的时候,要特别注意反斜杠\的使用. 下面有三种解决方式: 方式一:转义的方式 ...

  8. 出错:(unicode error) 'unicodeescape' codec can't decode bytes in position 8-9: malformed \N character escape

    报错原因:python 中 \N 是换行的意思.这里要把 N 前面的 \ 转义一下.用  \\  代替即可. Nokia_mac = np.loadtxt('data\oui\\NokiaMac201 ...

  9. (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape 错误

    使用网页版jupyder在读取桌面文件时,刚开始我的代码是: baseball = pd.read_csv('C:\Users\TuZhiqiang\Desktop\result.csv')print ...

  10. 18-(unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: truncated \uXXXX escape

    读取文件时碰到问题: 1.(unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: truncated \ ...

随机推荐

  1. 解决Maven下载依赖慢的问题

    参考:https://blog.csdn.net/web15085599741/article/details/126459039 <repositories> <repositor ...

  2. R语言3D图导出矢量图有bug

    谁不喜欢高清无码?rgl.snapshot就是个渣渣 首先,用rgl画3D图并调整好视角,代码如下: z <- 2 * volcano # Exaggerate the reliefx < ...

  3. pgsql查询结果生成序列

    一.row_number生成序列 select (row_number() over()) as id from generate_series(1,100) 二.根据指定列排序 select (ro ...

  4. centos7 yum安装配置Lnmp和负载配置

    首先配置防火墙CentOS 7.0默认使用的是firewall作为防火墙1.关闭firewall: systemctl stop firewalld.service #停止firewallsystem ...

  5. SQLSERVER 根据一个库的视图在另一个库中生成一张表

    select * into VPsiOuntStockBill from [KshDbPro].dbo.VPsiOuntStockBill

  6. 苹果电脑快捷键使用 Mac快捷键大全详细介绍

    相信有很多刚开始使用苹果电脑操作系统的用户,都并不了解整个MAC操作系统,就连一般快捷键的使用都不清楚,这让人很感觉很苦恼.分享一下Mac快捷键大全的详细介绍,记住这些常用的快捷键,是你熟悉苹果电脑的 ...

  7. spider_爬取内涵吧的段子(二级深度爬取)

    '''爬取内涵吧段子所有笑话(带标题,作者)总结:解码上,使用gbk2312编码的,我们可以采取gbk解码. 不会报错'''from fake_useragent import FakeUserAge ...

  8. 从redis中取出数据并转成java对象

    1.//数据存入redis中 redisTemplate.opsForValue().set(loginame, JSON.toJSONString(users),1000,TimeUnit.SECO ...

  9. css3 旋转 八仙桌

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. 什么叫IOCSABS呢

    所谓的IOCSABS,就是全新的管理技术,是结合客户端管理与网络平台管理为一体的创新观念及技术,     IOCSABS? (what is IOCSABS?) 英文的全称为Integrated Of ...