Hi everyone, I am not sure how to open a file in my computer in idle.
For my python class the homework states to write a function that accepts the name of a file and returns a tuple containing the number of lines, words and characters in the file. My problem is how do I get idle to first accept the name of a file. I created a file in text edit program saved with a .doc extension, saved on my desktop. However the only way I have learned to open a file in my class is to write something like: f = open('inputfile','r') line = f.readline() but when i type exactly that into my idle i get the following error message: Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> f = open('inputfile','r') IOError: [Errno 2] No such file or directory: 'inputfile' and when i ask it to open the actual file i created in my text edit program: file1.doc f = open('file1.doc','r') I get the same message. I am not sure how to tell it to go to desktop folder in my computer where i saved that file. Am I missing something, and completely not getting the point? Any help would be appreciated. Thanks so much!
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor