You Are Here Home > Ungzip a string in Python – gzinflate in Python

Ungzip a string in Python – gzinflate in Python

I was very surprised that I couldn’t do this easily in Python, so here is the solution to this:

import zlib
# ...
ungziped_str = zlib.decompressobj().decompress('x\x9c' + gziped_str)

Wow, PHP does it like this:

$ungziped_str = gzinflate($gziped_str);
Ungzip a string in Python – gzinflate in Python
Filed under: Programming, Python   Posted by: Codehead

Got a Question?

Get answers here.

1 Comment »

  1.  

    Props! That helped.

    Comment

RSS feed for comments on this post. TrackBack URL

Leave a comment