Linked Questions

Popular Questions

I'm using this command in my code

with open(r"files\data.txt", "r") as file:

and I'm getting this error

No such file or directory: 'files\\data.txt'

I've also tried using \ as I've seen this mentioned as a solution but it still doesn't work

with open("files\\data.txt", "r") as file:

comes out as

No such file or directory: 'files\\data.txt'

I feel like I'm following exactly as this site recommends https://www.geeksforgeeks.org/python-raw-strings/ but it still doesn't work. Does my raw string not work properly? I'm using VS Code if that helps.

Related Questions