[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> I used pickle and found the file was saved in text format. I wonder > >> whether anyone is familiar with a good compact off-the-shelf module > >> available that will save in compressed format... or maybe an opinion > >> on a smart approach for making a custom one? > > Joe> Well, here's a thought: create a zip file (using the standard > Joe> zipfile module), and pickle your data into that. > > Also, specify a pickle binary protool. Here's a silly example: > > >>> len(pickle.dumps([1,2,3], pickle.HIGHEST_PROTOCOL)) > 14 > >>> len(pickle.dumps([1,2,3], 0)) > 18
Or even >>> L = range(100) >>> a = pickle.dumps(L) >>> len(a) 496 >>> b = a.encode("bz2") >>> len(b) 141 >>> c = b.decode("bz2") >>> M = pickle.loads(c) >>> M == L True >>> -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list