Source
def select_parent(self):
ret = pyNodeList()
for node in self:
if len(node.children()) != 0 or len(node.text()) != 0:
ret.append(node)
if len(ret) == 1: return ret[0]
else: return ret
[internal] returns elements that have at least one child or text.
def select_parent(self):
ret = pyNodeList()
for node in self:
if len(node.children()) != 0 or len(node.text()) != 0:
ret.append(node)
if len(ret) == 1: return ret[0]
else: return ret