while loop with f.readline()

Michael A. Miller mmiller3 at iupui.edu
Thu Feb 15 18:49:11 CET 2001

    > From: "Chris Richard Adams"

    > I'm trying to create a loop that reads through a simple
    > file with strings on each line.

Take a look at the fileinput module:

    import fileinput
    for line in fileinput.input('filename'):

More information about the Python-list mailing list