compressed serialization module

Tino Wildenhain tino at wildenhain.de
Wed Nov 19 06:43:54 EST 2008


Hi,

greg wrote:
> Mark wrote:
>> Thanks guys.  This is for serializing to disk.  I was hoping to not
>> have to use too many intermediate steps
> 
> You should be able to use a gzip.GzipFile
> or bz2.BZ2File and pickle straight into it.
> 

also:

import codecs

out=codecs.open("picklefile.bz2",mode="wb",encoding="bz2")

pickle.dump(obj,out,pickle.pickle.HIGHEST_PROTOCOL)
out.close()

should work (and has far less code :-)

Regards
Tino
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20081119/2cefe752/attachment-0001.bin>


More information about the Python-list mailing list