Help with python-list archives
MRAB
python at mrabarnett.plus.com
Thu Jan 5 22:00:56 EST 2012
On 06/01/2012 02:14, random joe wrote:
> On Jan 5, 7:27 pm, MRAB<pyt... at mrabarnett.plus.com> wrote:
>
>> I've found that if I gunzip it twice (gunzip it and then gunzip the
>> result) using the gzip module I get the text file.
>
> On a windows machine? If so, can you post a code snippet please?
> Thanks
import gzip
in_file = gzip.open(r"C:\2012-January.txt.gz")
out_file = open(r"C:\2012-January.txt.tmp", "wb")
out_file.write(in_file.read())
in_file.close()
out_file.close()
in_file = gzip.open(r"C:\2012-January.txt.tmp")
out_file = open(r"C:\2012-January.txt", "wb")
out_file.write(in_file.read())
in_file.close()
out_file.close()
More information about the Python-list
mailing list