Pickle a file object

Guyon Morée gumuz at looze.net
Tue Dec 3 13:00:23 EST 2002


great!
thanx

guyon

"Michael Stenner" <mstenner at phy.duke.edu> wrote in message
news:mailman.1038923110.23313.python-list at python.org...
> 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