[Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Sep 24 04:59:21 CEST 2012


On 24 September 2012 03:26, Gregory Lund <gnj091405 at gmail.com> wrote:

> >
> > but a better way to do that is:
> > if item.endswith('.zip')
> >
> >>         x = zipfile.Zipfile(item,'r')
> >>         x.extractall()
> >>         x.close()
> >>
> ok, I used that (above)
> typed below:
>
> for item in zipContents:
>     if item.endswith('.zip'):
>         x = zipfile.Zipfile(item,'r')
>         x.extractall()
>         x.close()
>
> but now get a   "  x = zipfile.Zipfile(item,'r')
> AttributeError: 'module' object has no attribute 'Zipfile' "
>

Capital F. ZipFile not Zipfile.


>
> error
>
> grrrrr, this is going to send me to the funny farm!
>
> greg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120924/e28611de/attachment.html>


More information about the Tutor mailing list