f1 = open("mysample.txt", "r")
f2 = open("mysample2.txt", "r")
# go with first line to read
for line1 in f1:
for line2 in f2:
if line1==line2:
print("SAME\n")
else:
print("Line is Note Matched" + str(line1) + str(line2))
f1.close()
f2.close()
break
Asked
Active
Viewed 18 times
0

Barmar
- 741,623
- 53
- 500
- 612
-
Please fix the indentation. You have `break` outside all the loops. – Barmar Jun 29 '20 at 20:08
-
You can't loop through a file twice unless you call `f2.seek(0)` at the end of the inner loop. – Barmar Jun 29 '20 at 20:09