A neat way to iterate over two items of the same length

By Collin Anderson

I assume this is memory effeicient.

for line1, line2 in zip(file('file1.txt'), file('file2.txt')):
    print line1, line2

Tags: , ,

Leave a Reply