Quoting MRAB <goo...@mrabarnett.plus.com>: > 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 binary > too): > > zf = zipfile.ZipFile('Archive.zip') > for name in zf.namelist(): > open(os.path.join(output_folder, name), 'wb').write(zf.read(name)) >
Question here... wouldn't you also need to create all the intermediate folders from "output_folder" to "output_folder/name" (assuming that 'name' has several path parts in it)? Is there any elegant way to do it? (is there any way to make os.mkdir behave like mkdir -p?) -- Luis Zarrabeitia Facultad de Matemática y Computación, UH http://profesores.matcom.uh.cu/~kyrie Participe en Universidad 2010, del 8 al 12 de febrero de 2010 La Habana, Cuba http://www.universidad2010.cu -- http://mail.python.org/mailman/listinfo/python-list