I have 2 gzipped files of about 1Gb each. I want to read in both files simultaneously and compare every fourth line of both files with each other. Is there a faster way then doing it like this?
import gzip
file1 = r"path\to\file1.gz"
file2 = r"path\to\file2.gz"
for idx, (line1, line2) in enumerate(zip(gzip.open(file1), gzip.open(file2)), start=1):
if not idx%4:
compare(line1, line2)