# Programmer: Sriram Pemmaraju # Date: Feb 26th 2014 # This program reads lines repeatedly from a file and just prints # these to the screen in the order in which they are read. # input.txt is the name of a text file that is sitting in the same # directory as this program. You can create input.txt using a text editor # such as notePad or TextPad on Windows PC, TextEdit on Macs, or vi or emacs # on unix machines. In the case of Windows and Mac editors make sure that # you are saving the file as a text file and without any fancy formatting. f = open("input.txt") # The above open statement creates a "file handle" f that we can use to read # from the file input.txt. For example, the readline() method can be applied # to f to read a line (as a string) from it. Note that the line that is # read contains the end-of-line character at the end of the line as well. line = f.readline() while line: print line line = f.readline()