def getHash(f):
line = f.readline()
hash = hashlib.md5()
while (line):
hash.update(line)
line = f.readline()
return hash.hexdigest()
def IsHashEqual(f1, f2):
str1 = getHash(f1)
str2 = getHash(f2)
return str1 == str2
def ifNeedDelete(f1, f2):
f1s = open(f1, "rb")
f2s = open(f2, "rb")
if IsHashEqual(f1s, f2s):
return True
else:
return False
if __name__ == '__main__':
print(ifNeedDelete(f1, f2))