unziping a file in python..
google at mrabarnett.plus.com
Mon Mar 2 14:52:08 CET 2009
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
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
open(os.path.join(output_folder, name), 'wb').write(zf.read(name))
More information about the Python-list