Re: monitor reading file with thread

2010-01-18 Thread Aahz
In article <4b47712a$0$1115$4fafb...@reader4.news.tin.it>, wiso wrote: > >class Reader(): >def __init__(self,filename): >self.filename = filename >self.lineno = 0 >def __iter__(self): >f = open(self.filename) >for line in f: >self.lineno += 1 >

monitor reading file with thread

2010-01-08 Thread wiso
I'm reading and processing a huge file, so during the execution I want to now the state of the processing: how many lines are already processed, and so on. The first approach is: f = open(filename) n = 0 for l in f: if n % 1000 = 0: print "Reading %d lines" %n do_something(l) but I want