Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 18th, 2005, 09:30 PM
Richie Hindle
Guest
 
Posts: n/a
Default ElementTree.findtext()

Hi,

I can't get ElementTree.findtext() to work with anything other than a
single-level path:
[color=blue][color=green][color=darkred]
>>> from elementtree import ElementTree
>>> tree = ElementTree.fromstring("""\[/color][/color][/color]
.... <?xml version='1.0' encoding='us-ascii'?>
.... <html>
.... <head>
.... <title>The title</title>
.... </head>
.... </html>
.... """)[color=blue][color=green][color=darkred]
>>> print tree.findtext("*/title")[/color][/color][/color]
The title[color=blue][color=green][color=darkred]
>>> print tree.findtext("html/head/title")[/color][/color][/color]
None[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]

What am I missing?

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

--
Richie Hindle <richie@entrian.com>

 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles