cPickle.load() question

Dan Jones djones at shcorp.com
Sun Jun 8 13:20:17 EDT 2003


Irmen de Jong wrote:

> 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 :-)
>
> --Irmen
>
>
Thanks a lot, I didn't even think of doing it that way. :)






More information about the Python-list mailing list