Marco Mariani wrote: >> while True: >> a = filea.readline() >> b = fileb.readline() >> if not (a or b): >> break BTW, watch out for this break. It might not be what you want :-/