'''printwords.py -- a demonstration of how to step through the words in a text file. Jeff Ondich, 9/18/07 This program uses the "words" module to print a list of all the words in a file. You need to make sure that words.py, printwords.py, and the text file you specify for testing are all in the same directory before you run the program. Otherwise, the "import" statement or the "open" statement will fail. ''' import words fileName = raw_input('For what file do you wish to print all the words? ') inputFile = open(fileName, 'r') w = words.getword(inputFile) while len(w) > 0: print w w = words.getword(inputFile) inputFile.close()