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

Method find

Lib/xml/etree/ElementTree.py:276–285  ·  view source on GitHub ↗

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

(self, path, namespaces=None)

Source from the content-addressed store, hash-verified

274 raise ValueError(f"{subelement!r} not in {self!r}") from None
275
276 def find(self, path, namespaces=None):
277 """Find first matching element by tag name or path.
278
279 *path* is a string having either an element tag or an XPath,
280 *namespaces* is an optional mapping from namespace prefix to full name.
281
282 Return the first matching element, or None if no element was found.
283
284 """
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.

Callers 6

test_find_with_errorMethod · 0.95
writexmlMethod · 0.45
selectFunction · 0.45
findMethod · 0.45

Calls

no outgoing calls

Tested by 3

test_find_with_errorMethod · 0.76