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 on May 6, 2009

Disclaimer
1 - Use the information provided here at your own risk.
2 - You may not republish this content without prior written consent.




No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment