Search code examples
macospathidentification

Specifying file path in Mac


I shifted to Mac last week and trying to run python code that i used in my windows machine. However, I could not specify the file path correctly and repeatedly getting error.

File path as seen from machine:

enter image description here

The code i used is as follows:

 for line in open('Macintosh HD/Users/mageshpoondi/Documents/2015/Travel/IPL2015-5.5.2015.txt')

I tried including Magesh's MacBook Pro before Macintosh HD, replaced forward slash with backward ones, removed the space between Macintosh & HD...nothing seem to work...getting an error..."No such file or directory".

I am sure this is a trivial question....but fighting for an answer for couple of hours is frustrating.

Can someone help please?


Solution

  • What you really want is /Users/mageshpoondi/Documents/2015/Travel/IPL2015-5.5.2015.txt. It's a standard UNIX path.