Next / Previous / Contents / TCC Help System / NM Tech homepage

8.7. Element.findtext(): Extract text content

Every Element instance E has a .findtext() method that works very similarly to Section 7.3, “ElementTree.findtext(): Retrieve the text content from an element”. Here is the general form:

E.findtext ( path, default=None )

If any child elements of E exist that match the given path, this method returns the text content of the first matching element. If the element exists but has no text content, the method returns "", the empty string. If there are no matching child elements, the method returns None.