I am creating a dict to hold name and phone number, storing to local by pickle. the issue now I am facing is: it seems like the merge is not working fine. , any idea? thanks.
import pickle
def add(name,contact):
person= {};
person[name] = contact;
print('new added: ',person);
mycontactfile = 'contactlist.txt';
f = open(mycontactfile,'rb');
storedcontact = pickle.load(f);
f.close();
print('saved list:',storedcontact);
storedcontact.update(person); # add a new contact to the list
f = open(mycontactfile,'wb');
pickle.dump(storedcontact,f);
print('now full list is:' ,storedcontact);