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

Stefan Behnel stefan_ml at behnel.de
Wed Feb 4 21:20:53 CET 2009


Dirk Rothe wrote:
> On Wed, 04 Feb 2009 20:56:40 +0100, Stefan Behnel <stefan_ml at behnel.de>
> wrote:
>> It's actually rare that the expected type isn't known in advance, but for
>> this kind of use case, you can just test the type as usual, i.e. use
>> isinstance() to check for basestring, float or list.
> 
> ..or scalar bools.

True. See the docs for details.

http://codespeak.net/lxml/xpathxslt.html#xpath-return-values

Stefan


More information about the lxml-dev mailing list