pickle

Fredrik Lundh fredrik at pythonware.com
Tue Oct 25 03:53:53 EDT 2005


Shi Mu wrote:

> what does the following code mean?
>
> y = pickle.load(file("cnumber.pickle", "r"))

open the file "cnumber.pickle" for reading, pass the file handle to
the pickle.load function, and store the result in the "y" variable.

> also, I can not understand "f" in pickle.dump(x, f)

the second argument to pickle is a file handle, opened for writing.
pickle.dump will save the "pickled data" to that file.

</F> 






More information about the Python-list mailing list