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@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to