Help with python-list archives

random joe pywin32 at gmail.com
Thu Jan 5 23:01:25 EST 2012


On Jan 5, 9:00 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:
> 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()

EXCELLENT! Thanks.

THis works however there is one more tiny hiccup. The text has lost
all significant indention and newlines. Was this intended or is this a
result of another bug?



More information about the Python-list mailing list