Hi Navin, On Tue, Dec 6, 2011 at 9:54 AM, Navin Kabra <navin.ka...@gmail.com> wrote: > On Tue, Dec 6, 2011 at 9:49 AM, Vikas BN <vikas...@gmail.com> wrote: >> I'm working on a script to parse XML files and am using > > Any object that has a __len__ defined will evaulate to False in a > boolean context if __len__ returns 0. (See also __nonzero__). > > See section 5.1 here: http://docs.python.org/library/stdtypes.html Thanks! That's it I think.
>>> c1.__len__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: __len__ >>> len(c1) 0 So len(c1) is returning 0. But I don't undestand why __len__ is throwing an AttributeError. Time to read ElementTree docs I suppose. Thanks! Vikas _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers