[lxml-dev] how knowing the types return by .xpath
Stefan Behnel
stefan_ml at behnel.de
Thu Feb 5 09:18:25 CET 2009
Sergio Monteiro Basto wrote:
>> > 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 .
You either get a single result (if you asked for it, e.g. as a function
return value), or you get a list of results. In any case, the set of
possible return types is the same.
Stefan
More information about the lxml-dev
mailing list