It might seem a simple question.. but how does one programmaticaly unzip a
file in python?
In version 2.6 and above.. the zipfile module has an extractall method. But
it isn't available in 2.5 or below.
Any cross version, cross-platform answers welcome.
Any answers specific to win32 also welcom
On Mon, 02 Mar 2009 01:00:54 -0500, David Lyon wrote:
> It might seem a simple question.. but how does one programmaticaly unzip
> a file in python?
A quick and dirty solution would be something like this:
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
open(name, 'w').write(
Steven D'Aprano wrote:
On Mon, 02 Mar 2009 01:00:54 -0500, David Lyon wrote:
It might seem a simple question.. but how does one programmaticaly unzip
a file in python?
A quick and dirty solution would be something like this:
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
Quoting MRAB :
> Steven D'Aprano wrote:
> > A quick and dirty solution would be something like this:
> >
> > zf = zipfile.ZipFile('Archive.zip')
> > for name in zf.namelist():
> > open(name, 'w').write(zf.read(name))
> >
> You might want to specify an output folder (and the data might be bin
Luis Zarrabeitia wrote:
Quoting MRAB :
Steven D'Aprano wrote:
A quick and dirty solution would be something like this:
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
open(name, 'w').write(zf.read(name))
You might want to specify an output folder (and the data might be bin
En Mon, 02 Mar 2009 13:09:05 -0200, Luis Zarrabeitia
escribió:
Quoting MRAB :
Steven D'Aprano wrote:
>
You might want to specify an output folder (and the data might be binary
too):
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
open(os.path.join(output_folder, name), 'wb
On Mon, 02 Mar 2009 16:13:39 +, MRAB
wrote:
> zf = zipfile.ZipFile('Archive.zip')
> for name in zf.namelist():
> new_path = os.path.join(output_folder, name)
> data = zf.read(name)
> try:
> open(new_path, 'wb').write(data)
> except IOError:
> # Create i