Kent Johnson <kent37 <at> tds.net> writes: > > Jacob S. wrote: > >> sorry to send this to you but if you may, kindly send to tutor list as im > >> no longer subscribed. my problem is in the update dict portion: it just > >> doesnt update regardless how many contacts i add. kindly advise where > >> my mistake is or code gone wrong. the rest of the options i will do on my > >> own so just hold off the helps for now. appreciate all your good help. > > >> def update_dict(d, f): > >> ''' update the saved dictionary file ''' > >> > >> read = open(f, 'rb') > >> newdic = cPickle.load(read) > >> newdic.update(d) > >> read.close() > > You don't do anything with newdic. My guess is you want to dump it back to the file so it is saved. >
this is what i tried: read = open(f, 'rb') newdic = cPickle.load(read) newdic.update(d) read.close() write = open(f, 'wb') cPickle.dump(f, write) write.close() but it 'overwrites' the saved dic. can you rw in one go, dump and load the updated dict instantly?? sending this in gmane mail2news gateway. -- regards, erimendz _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor