From where does python pick its file for reading.Is there any specific folder,or does it pick from anywhere on the system just given the filename and extension.Is there a need to mention absolute path. I am getting error while reading txt and csv files as no such file or directory. f=open('info.csv') print f I get a handle for the above file.But don't get a handle for .txt,both are in the same folder.Why does it give an error?
Asked
Active
Viewed 197 times
0
-
1Your code? Your current output (error?)? Your expected output? – Mathias Jul 11 '16 at 13:33
-
Possible duplicate of [Find current directory and file's directory](http://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory) – dot.Py Jul 11 '16 at 13:34
-
code is very simple. f=open('info.txt') print f the same works for f=open('fly.csv') print f both are in same folder.I get a handle for .csv whereas i don't get for .txt. – psp Jul 11 '16 at 13:36
1 Answers
0
By default, python checks for the requested file in the same directory the program file is in. If you want python to check for the file in some other location, you have to specify the absolute path.
About your error, nothing can be said unless you share your code.

Muathasim Mohamed P
- 15
- 1
- 7