pickle
Steve Holden
steve at holdenweb.com
Tue Oct 25 07:03:52 EDT 2005
Shi Mu wrote:
> what does the following code mean?
>
> y = pickle.load(file("cnumber.pickle", "r"))
>
Take it by parts:
file("cnumber.pickle", "r")
returns a file object as a result of opening the "cnumber.pickle" file,
which is presumably a pickle someone wrote earlier.
So
pickle.load(file("cnumber.pickle", "r"))
returns the first object stored in that pickle file.
> also, I can not understand "f" in pickle.dump(x, f)
>
The beginning of the docs on pickle usage says:
"""dump( obj, file[, protocol[, bin]])
Write a pickled representation of obj to the open file object file."""
Isn't this reasopnably self-explanatory?
regards
Steve
>[...]
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list