[lxml-dev] how knowing the types return by .xpath

Sergio Monteiro Basto sergio at sergiomb.no-ip.org
Thu Feb 5 03:23:29 CET 2009


On Wed, 2009-02-04 at 21:20 +0100, Stefan Behnel wrote:
>  
> True. See the docs for details.
> 
> http://codespeak.net/lxml/xpathxslt.html#xpath-return-values

I read this before my first post. 

> > elems=etree_document.xpath(strxpath)
> > 
> > for frags in elems:
> >     print type (frags)

when .xpath return a list, the elements of the list could have different
types, I found at least two , etree._Element and
etree._ElementUnicodeResult .

How could I know if a variable is a etree._Element ? and not other
object like for example  etree._Entity .

Thanks, 

-- 
Sérgio M.B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2192 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20090205/d65096d3/attachment.bin 


More information about the lxml-dev mailing list