how to gunzip a string ?

Andreas Kuntzagk andreas.kuntzagk at mdc-berlin.de
Thu Jul 31 04:33:22 EDT 2003


On Wed, 30 Jul 2003 16:16:32 +0200, Bill Loren wrote:

> I guess I really need some sort of library that will do a gzip decoding to
> a compressed string.
> assume that I have a gzipped_string_reply I got from an HTTP server, It'd
> be superb to have a gunzip class that takes it and return its decoded
> equivalent.


You could put your string in an cStringIO:

c_string= cStringIO.StringIO(compressed_string)
gzip_handle=gzip.GzipFile(fileobj=c)
gzip_handle.read()

HtH, Andreas




More information about the Python-list mailing list