[Tutor] pickle.load() all dict

Yutao Deng edquiver at gmail.com
Sun May 16 14:45:33 CEST 2010


LOL, try...except is a good idea.
i fix it  lick this:

############
with open("data2.pickle","rb") as file_stream:
    c = 0
    while True:
        try:
            i = cPickle.load(file_stream)
            print i
            c += 1
        except:
            print "Numer of pickled objects is %s." %c
            break
#############
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100516/80d05079/attachment.html>


More information about the Tutor mailing list