What is the pythonic way of iterating simultaneously over two lists?
Suppose I want to compare two files line by line (compare each ith line in one file
i
In lockstep (for Python ≥3):
for line1, line2 in zip(file1, file2): # etc.
As a "2D array":
for line1 in file1: for line2 in file2: # etc. # you may need to rewind file2 to the beginning.