How to make direction to filename to read it from IDLE?

93 Views Asked by At

If i have a filename in this direction in my laptop:

F:\python\python filenames

which named test.txt And if My program direction is:

C:\Users\Msi\AppData\Local\Programs\Python\Python36

which named fib.py


How can i read or make change to my filename without copying it beside my program fib.py? I must write the direction of my filename in my program file?? How can i do that to above example? I tried this:filename='F:\python\python filenames\test.txt' in my program But it didn't work!Error:

OSError: [Errno 22] Invalid argument: 'F:\\python\\python filenames\test.txt'
1

There are 1 best solutions below

0
On BEST ANSWER

Anyway I found the solution:

filename='F:\\python\\python filenames\\test.txt'

it works!