M
mirandacascade
1) It appears as if the following logic works for determining whether
an element is a parent:
# assume elem is an ElementTree element
if (elem.getchildren() == None):
print 'this element is not a parent'
else:
print 'this element is a parent'
My question is this: are there any other ways of determining whether an
element is a parent, and if so, are they preferable to the method
above? (I don't have a definition for 'preferable'; I'm hoping the
reply to this question will suggest why a different method may be
preferable.)
2) At one time, I thought I saw some notes indicating that the
getchildren() method will be deprecated. Now, however, I cannot locate
those notes. Has the getchildren() method been deprecated, or will it
be deprecated?
an element is a parent:
# assume elem is an ElementTree element
if (elem.getchildren() == None):
print 'this element is not a parent'
else:
print 'this element is a parent'
My question is this: are there any other ways of determining whether an
element is a parent, and if so, are they preferable to the method
above? (I don't have a definition for 'preferable'; I'm hoping the
reply to this question will suggest why a different method may be
preferable.)
2) At one time, I thought I saw some notes indicating that the
getchildren() method will be deprecated. Now, however, I cannot locate
those notes. Has the getchildren() method been deprecated, or will it
be deprecated?