[Tutor] Address book sort of

Isr Gish isrgish at fastem.com
Tue Dec 7 05:06:04 CET 2004


It was posted recently that pickleing should use binary mode.
See changes in code.

Rick Muller wrote:
   >
   >from cPickle import load, dump
   >
   >def save(fname,addressbook):
   >    file = open(filename,'w')

file = open(filename,'wb')

   >    dump(addressbook,file)
   >    file.close()
   >    return
   >
   >def read(fname):
   >    file = open(filename)

file = open(filename, 'rb')

   >    addressbook = load(file)
   >    file.close()
   >    return addressbook


All the best
Isr



More information about the Tutor mailing list