Opening a csv file in python on a mac

MRAB python at mrabarnett.plus.com
Sat May 12 21:33:05 EDT 2012


On 12/05/2012 23:50, Brian Heese wrote:
> I created a csv file called python test file.csv. It is stored on my
> Desktop directory.  When I try to open it using the command open
> ('Desktop python test file.csv') I get the following error: "No such
> file or directory". The same thing happens if I use open ('python
> test file.csv'). What I am I doing wrong?

You should provide the full absolute path of the file.

'python test file.csv' is the name of the file, but it doesn't say
where it is, and 'Desktop python test file.csv' is also just a name.
(Is the file called 'Desktop python test file.csv'? No. It's called
'python test file.csv' and it's in the 'Desktop' directory, wherever
that is.)



More information about the Python-list mailing list