[Tutor] Python 3.4.1 question for Mac users
Chris “Kwpolska” Warrick
kwpolska at gmail.com
Fri Aug 29 18:37:41 CEST 2014
On Fri, Aug 29, 2014 at 5:01 PM, Richard Dillon <dillonrw at comcast.net> wrote:
> I’m teaching myself Python 3.4.1 on a Mac and the book I’m using is written
> for Windows users.
>
> I’m trying to open a file on the desktop and I created a path using the
> example in the book.
>
>
>
> Any Mac users out there with a solution? My main drive is named “OS”.
>
> Here’s my code:
>
>
>
> def main():
>
> my_file = input('Enter file to open: ')
>
> infile = open(r'\OS\Users\richarddillon\Desktop\my_file','r')
>
> file_contents = infile.read()
>
> infile.close()
>
> print(file.contents)
>
>
>
> main()
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
--
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
More information about the Tutor
mailing list