cPickle.load() question

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sun Jun 8 18:39:43 CEST 2003

Dan Jones wrote:
> Hello all!
> I'm new to python and am trying to write a simple program to keep a list 
> of my customers and generate pdf invoices for them (haven't gotten that 
> far yet, any pdf module recommendations?). I have defined a customer 
> class and a function to pickle them into a file. I'm just not sure how 
> to go about reading the customer file back in. Is there a way to iterate 
> over a pickled file and cPickle.load() each entry into a list?

Just pickle the whole list instead of each customer object separately!
Then the unpickling will return your whole list of customer objects :-)


More information about the Python-list mailing list