On Tue, 23 Jul 2002, Shagshag13 wrote: S> hello, S> S> i need to count lines in a file (that i *can't* keep in S> memory, so can't use readlines()) fp = open(filename) it = iter(fp) try: while it.next(): count += 1 except StopIteration: pass -- Denis S. Otkidach http://www.python.ru/ [ru] http://diveinto.python.ru/ [ru]