MCPcopy Index your code
hub / github.com/python/cpython / findtext

Method findtext

Lib/xml/etree/ElementTree.py:287–299  ·  view source on GitHub ↗

Find text for first matching element by tag name or path. *path* is a string having either an element tag or an XPath, *default* is the value to return if the element was not found, *namespaces* is an optional mapping from namespace prefix to full name. Return text

(self, path, default=None, namespaces=None)

Source from the content-addressed store, hash-verified

285 return ElementPath.find(self, path, namespaces)
286
287 def findtext(self, path, default=None, namespaces=None):
288 """Find text for first matching element by tag name or path.
289
290 *path* is a string having either an element tag or an XPath,
291 *default* is the value to return if the element was not found,
292 *namespaces* is an optional mapping from namespace prefix to full name.
293
294 Return text content of first matching element, or default value if
295 none was found. Note that if an element is found having no text
296 content, the empty string is returned.
297
298 """
299 return ElementPath.findtext(self, path, default, namespaces)
300
301 def findall(self, path, namespaces=None):
302 """Find all matching subelements by tag name or path.

Calls

no outgoing calls