')

问题描述 投票:0回答:1
I'm getting the no such file exists error. I tried to prefix the file_location string with r and thats not working too. I would appreciate if someone could help me with this.

I have a file in windows remote server which I'm trying to read in a pandas dataframe. The file path has white spaces and dots in it. Following is what I'm trying to do but its not working for me. ...

Backslahes are used to tell the parser that the next character should be interpreted as an escapce sequence and not a regular character

python pandas filepath
1个回答
0
投票

df = pd.read_csv(filelocation, sep = 'operator.For example if you want to print " you have to use escape sequence \":

print("This is a quotation mark: \".")

输出。

This is a quotation mark: ".

如果你使用一个反斜杠,下一个字符就会被标记为转义序列,从而使路径无效。为了解决这个问题,你可以使用反斜杠的转义序列,也就是反斜杠,或者在大多数情况下,你可以使用正向斜杠,因为大多数图书馆会自动将其转换为反斜杠。

© www.soinside.com 2019 - 2024. All rights reserved.