I wrote this code that calculate the hash value for a pdf file and add it to a dictionary and save it to a file like this:
v={hash_value:{"file name":file_name,"number":1}}
But the problem with the below code is that if I add a new file it overwrite the previous one.
f = calculate_hash("calc.pdf")
v = {f:{"file name":"calc.pdf","number":1}}
with open('filename.pickle', 'wb') as handle:
pickle.dump(v, handle)
with open('filename.pickle', 'rb') as handle:
b = pickle.load(handle)
x= calculate_hash("calc.pdf")
for key in b:
print key
if x == key:
print "yes"