[Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.
d at davea.name
Mon Sep 24 05:15:07 CEST 2012
On 09/23/2012 10:26 PM, Gregory Lund wrote:
> for item in zipContents:
> if item.endswith('.zip'):
> x = zipfile.Zipfile(item,'r')
> but now get a " x = zipfile.Zipfile(item,'r')
> AttributeError: 'module' object has no attribute 'Zipfile' "
> grrrrr, this is going to send me to the funny farm!
One way to avoid the "funny farm" is to learn to use the tools that
Python provides, built-in. As soon as you get an error like that one,
add a print statement immediately before the one in error, and find the
type and attributes of the object that supposedly doesn't have the
attribute. For example, you could have added a dir(zipfile), and then
studied the one that seems to be the same as the one you tried to use.
Presumably you would have quickly discovered what Oscar pointed out.
We all make typos, the difference is in how quickly we find and fix
them. Use the tools.
More information about the Tutor