while loop with f.readline()

Michael A. Miller mmiller3 at iupui.edu
Thu Feb 15 12:49:11 EST 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'):
        process(line)




More information about the Python-list mailing list