I\'m trying to figure out the best way to compress a stream with Python\'s zlib.
zlib
I\'ve got a file-like input stream (input, below) and an o
input
Use the cStringIO (or StringIO) module in conjunction with zlib:
>>> import zlib >>> from cStringIO import StringIO >>> s.write(zlib.compress("I'm a lumberjack")) >>> s.seek(0) >>> zlib.decompress(s.read()) "I'm a lumberjack"