On Tue, Jan 29, 2013 at 1:37 AM, Dave Angel <d...@davea.name> wrote: > What you want is the zip() function > > for l,s in zip(f1, f2): > #you now have one line from each file, > # which you can then validate and process > > Note, this assumes that when a line is "bad" from either file, you're going > to also ignore the corresponding line from the other. If you have to > accommodate variable misses in the lining up, then your work is *much* > harder.
Much harder? Not really - see my solution above with a simple 'break'. Much less clear what's going on, though, it is. Iterating together over both files with zip is much cleaner. ChrisA -- http://mail.python.org/mailman/listinfo/python-list