python xpath

John Lenton jlenton at gmail.com
Tue Jul 13 22:07:22 EDT 2004


On Wed, 14 Jul 2004 01:23:00 GMT, Jason Jesso <jesso1607 at rogers.com> wrote:
> flight = self.ctxt.xpathEval( "table/tr/td/a/text()" )
> print flight[0]
> 
> I am evaluating this xpath expression using python's libxml2.
> 
> How can I get the actual text data?  When I print the result set I get text
> node information, like the address and stuff.
> 
> This is probably a stupid question, but I can't seem to get it.

try help(libxml2) from the interpreter, or pydoc libxml2 from the shell. I'd do

  print flight[0].content

(or getContent(), or get_content())

-- 
John Lenton (jlenton at gmail.com) -- Random fortune:
bash: fortune: command not found



More information about the Python-list mailing list