473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 5270
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Greg Bakken | last post by:
I am writing a python program that recieves 'compressed and encoded' strings from another piece of software. I can successfully uncompress and decode the strings via import base64, zlib def...
2
by: enrio | last post by:
I have a string which I try to decompress: body = zlib.decompress(body) but I get zlib.error: Error -3 while decompressing data: incorrect header check However, I can write the string to...
3
by: steve | last post by:
I am having problems with phymyadmin on Windows. When exporting using gzip compression option, and the db is large, I seem to be getting trashed results (gunzip complains about extra trash data). ...
10
by: Xah Lee | last post by:
today i need to use Python to decompress gzip files. since i'm familiar with Python doc and have 10 years of computing experience with 4 years in unix admin and perl, i have quickly located the...
2
by: comp.lang.php | last post by:
I am simply trying to zip together selected files into a single ZIP file. Windows XP doesn't have a native process by which you can do this, so I borrowed gzip, downloaded and installed, and upon...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
14
by: Bill | last post by:
I've written a small program that, in part, reads in a file and parses it. Sometimes, the file is gzipped. The code that I use to get the file object is like so: if filename.endswith(".gz"):...
4
by: mathieu | last post by:
Hello, Browsing the archive of this group I see that the c++ iostream wrapper that are shipped with zlib are not satisfying : ...
2
by: syahreza.octadian | last post by:
Dear all, Please help, i have error message when i import gzip module. The error like this below: bash-3.00$ python Python 2.5 (r25:51908, Sep 20 2006, 03:46:40) on sunos5 Type "help",...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.