find() method in ElementTree

Fredrik Lundh fredrik at
Sat Oct 22 20:08:38 CEST 2005

mirandacascade at wrote:

> My questions:
> 1) in the example above is there a subelement of doc with a tag
> 'SampleDetails'?

find only searches for direct subelements; SampleDetail is not a direct
subelement to SampleRoot, since there's a SpecificInformation element
in between.

> 2) if so, what is the proper way of writing the call to the find()
> method to locate that subelement?

    elem = doc.find(".//SampleDetail")

should work.


More information about the Python-list mailing list