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():
    open(name, 'w').write(zf.read(name))

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').write(zf.read(name))

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to