You have exhausted the iterator after the first iteration over f2, you need file.seek(0)to go back to the beginning of the file.
for line1 in f1:
found = False
for line2 in f2:
if repr(line1) == repr(line2):
print("true")
f2.seek(0)
You check only the first line f1by line f2, after the first loop there is no iteration.
, , break, , , reset found = False .
, , .
with open("f1") as f1, open("f2") as f2:
st = set(f1)
common = st.intersection(f2)
, st.difference(f2), st.symmetric_difference(f2). , .
filecmp difflib