#!/usr/bin/env python # assuming the file fits into memory, this program will # display the program and number the lines. # # written by e.bonakdarian dec 2009 # # similar version presented originally in class by # Amanda Bagwell and Victoria Temple # from random import randrange FILENAME = 'c:/esmail/watson.joke.txt' f = open(FILENAME) text = f.readlines() f.close() # done with file count = 1 for line in text: print '%03d : %s' % (count, line), count += 1 raw_input('\n to exit.')