Pickle a file object
Michael Stenner
mstenner at phy.duke.edu
Tue Dec 3 08:44:47 EST 2002
On Mon, Dec 02, 2002 at 11:19:55PM +0000, Guyon Morée wrote:
> and lets'say i'd want to embed binary files, images (eg. jpg) into my file?
> not storing a link to a location on the harddrive.
>
> can i read and store the contents of binary files?
Absolutely. When you do
foo = file_object.read()
then foo is just a string. Strings can contain binary data in python
just fine, and strings are pickleable.
-Michael
--
Michael Stenner Office Phone: 919-660-2513
Duke University, Dept. of Physics mstenner at phy.duke.edu
Box 90305, Durham N.C. 27708-0305
More information about the Python-list
mailing list