file1 = "1.txt"
file2 = "3.txt"
#f_diff = "diff.txt"
f1 = open(file1, "r")
f2 = open(file2, "r")
file1 = f1.readlines()
file2 = f2.readlines()
f1.close()
f2.close()
flag = 0
'''
for i in file1:
if i not in file2:
outfile.write(i)
flag = 1
'''
a=0
for i in file2:
if i not in file1:
continue
else:
a=a+1
print(i)
print(a)
python 比对两个文档将一样的输出
最新推荐文章于 2024-06-11 09:48:10 发布