[BangPypers] Pickle multiple objects
Roshan Mathews
rmathews at gmail.com
Wed Oct 7 09:56:28 CEST 2009
On Wed, Oct 7, 2009 at 1:23 PM, Roshan Mathews <rmathews at gmail.com> wrote:
> On Wed, Oct 7, 2009 at 1:14 PM, Aneesh A <aneesh.nl at gmail.com> wrote:
>> I have to store high scores, so i pickled a list . after pickling, in append
>> mode, load method loads only first object.
>> How to retrieve multiple objects??
>
> What does this do:
>
> import cPickle as pickle
> list = [ (i, str(i)) for i in range(10) ]
> print list
> pickle.dump(list, file('dump', 'wb'), -1)
> list = pickle.load(file('dump', 'rb'))
> print list
>
Also, in
store_highscores(highscore)
the subject and verb don't match. Do you want to
store_highscores(highscores) or store_highscore(highscore)?
Roshan Mathews
More information about the BangPypers
mailing list