line-by-line file read

Andy Gimblett gimbo at ftech.net
Fri Mar 15 08:04:19 EST 2002


Here's one way:

fo = open(filename)
while 1:
    line = fo.readline()
    if not line:
        break
    do_stuff(line)
fo.close()

-- 
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.




More information about the Python-list mailing list