On Fri, Aug 29, 2014 at 5:01 PM, Richard Dillon <[email protected]> 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 - [email protected] > 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 _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
