for row, line in enumerate(inputFileHandle):
    if line_meets_condition:
        outputFileHandle.write(line)
else:
    lstIgnoredRows.append(row)
Parsing large (20GB) text file with python - reading in 2 lines as 1