且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

(unicode 错误)“unicodeescape"编解码器无法解码位置 2-3 中的字节:截断的 UXXXXXXXX 转义

更新时间:2021-09-24 18:37:54

出现此错误是因为您使用的是普通字符串作为路径.您可以使用以下三种解决方案之一来解决您的问题:

This error occurs because you are using a normal string as a path. You can use one of the three following solutions to fix your problem:

1:只需将 r 放在普通字符串之前,它会将普通字符串转换为原始字符串:

1: Just put r before your normal string it converts normal string to raw string:

pandas.read_csv(r"C:UsersDeePakDesktopmyac.csv")

2:

pandas.read_csv("C:/Users/DeePak/Desktop/myac.csv")

3:

pandas.read_csv("C:\Users\DeePak\Desktop\myac.csv")