I have two files, and I want to perform some line-wise operation across both of them. (In other words, the first lines of each file correspond, as do the second, etc.) Now,
You could try
for line1, line2 in zip(file1, file2): #do stuff
Careful though, this loop will exit when the shorter file ends.
When using Python 2, itertools.izip is better for this sort of thing because it doesn't create a list.
itertools.izip
list