Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > ElementTree.findtext()

Reply
Thread Tools

ElementTree.findtext()

 
 
Richie Hindle
Guest
Posts: n/a
 
      01-21-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 <(E-Mail Removed)>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments