ElementTree.findtext()

Richie Hindle richie at entrian.com
Fri Jan 21 09:41:01 EST 2005


Hi,

I can't get ElementTree.findtext() to work with anything other than a
single-level path:

>>> from elementtree import ElementTree
>>> tree = ElementTree.fromstring("""\
... <?xml version='1.0' encoding='us-ascii'?>
... <html>
... <head>
... <title>The title</title>
... </head>
... </html>
... """)
>>> print tree.findtext("*/title")
The title
>>> print tree.findtext("html/head/title")
None
>>> 

What am I missing?

I'm using elementtree-1.2.4-20041228 on Windows with Python 2.3.

-- 
Richie Hindle <richie at entrian.com>




More information about the Python-list mailing list