Gzip - gunzip using zlib

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • flebber

    #1

    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

  • Paul Rubin

    #2
    Re: Gzip - gunzip using zlib

    flebber <flebber.crue@g mail.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('parr ot.gz')
    for line in z:
    ...

    Comment

    • Stefan Behnel

      #3
      Re: Gzip - gunzip using zlib

      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

      Comment

      Working...