-----Original Message-----
From: Tutor [mailto:tutor-bounces+a.bull=pubdmgroup....@python.org] On Behalf 
Of Chris “Kwpolska” Warrick
Sent: Friday, August 29, 2014 11:40 AM
To: Richard Dillon
Cc: tutor@python.org
Subject: Re: [Tutor] Python 3.4.1 question for Mac users

Sorry for the errorneous quote-only response, gmail managed to send it without 
me typing a thing.

On Fri, Aug 29, 2014 at 5:01 PM, Richard Dillon <dillo...@comcast.net> wrote:
>     infile = open(r'\OS\Users\richarddillon\Desktop\my_file','r')

On the Mac, you don’t need to specify a drive there; the main drive is just /.

Also, the path separator is a forward slash (/).  This also lets you remove the 
r in front of the string, which is needed for backslashes unless you escape 
them.  The corrected code is:

infile = open('/Users/richarddillon/Desktop/my_file', 'r')

--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
[Al Bull] 

Isn't he still mixing a string and a string variable is his open statement?   
My_file is a string variable.   I'm still learning Python myself so I could 
very well be incorrect.. :)



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to