[lxml-dev] extracting .text strings systematically in unicode

John Lovell jlovell at nwesd.org
Tue Dec 9 19:11:12 CET 2008


The first one is the one the raises an exception for non-strings?

John

----

You can either switch to Py3.0 where lxml always returns unicode strings, or you can stick to casting the string yourself. BTW, it's faster to do

        u""+s

than to do

        unicode(s)

although it might be considered less readable. It has the advantage of raising an exception for non-strings, though.

Stefan



More information about the lxml-dev mailing list