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

J. Clifford Dyer jcd at sdf.lonestar.org
Tue Dec 9 19:21:24 CET 2008


> 
On Tue, 2008-12-09 at 10:11 -0800, John Lovell wrote:
> The first one is the one the raises an exception for non-strings?
> 
> John
> 


Yes:

Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> unicode(1)
u'1'
>>> u""+1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, int found
>>> 




More information about the lxml-dev mailing list