471,328 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,328 software developers and data experts.

Gzip - gunzip using zlib

Hi Can anyone show me a working example of how to use gzip to
decompress a file. I have read the docs at python.org and had many
goes at it but just can't get it to work.

Cheers

flebber

Jun 9 '07 #1
2 5203
flebber <fl**********@gmail.comwrites:
Hi Can anyone show me a working example of how to use gzip to
decompress a file. I have read the docs at python.org and had many
goes at it but just can't get it to work.
Untested in this instance, but this is how I usually do it:

import gzip

z = gzip.open('parrot.gz')
for line in z:
...
Jun 9 '07 #2
flebber wrote:
Hi Can anyone show me a working example of how to use gzip to
decompress a file. I have read the docs at python.org and had many
goes at it but just can't get it to work.
According to your other post, you are trying to open a ZIP archive using gzip.
Use the zipfile module instead.

Stefan
Jun 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Greg Bakken | last post: by
2 posts views Thread by enrio | last post: by
10 posts views Thread by Xah Lee | last post: by
2 posts views Thread by comp.lang.php | last post: by
14 posts views Thread by Bill | last post: by
4 posts views Thread by mathieu | last post: by
2 posts views Thread by syahreza.octadian | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.