[Tutor] zip question
jfouhy@paradise.net.nz
jfouhy at paradise.net.nz
Tue May 10 03:19:52 CEST 2005
Quoting "D. Hartley" <denise.hartley at gmail.com>:
> Instances have the following attributes:
>
> filename, comment, etc.
>
>
> I've tried about ten things to get "filename" to work:
>
> myzip.filename("99905.txt") (str not callable)
Check out the error message: "str not callable". You are trying to call
something whose type is "str" --- ie: a string. In python, there is no
distinction between callable and noncallable attributes.
try:
>>> print myzip.filename
It should print the filename that this ZipInfo object refers to.
Likewise, myzip.comment is a string which is the comment attached to the file in
the zip.
If you have any background in other languges, it might help you to think of
these as "member variables" (or whatever they call them). And a ZipInfo object
appears to be similar to a struct in C/C++.
I hope this helps.
(and if it doesn't, the fault is probably in the explanation, so keep asking,
and I (or someone else) will try again :-) )
--
John.
More information about the Tutor
mailing list