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

Stefan Behnel stefan_ml at behnel.de
Tue Dec 9 19:14:12 CET 2008


John Lovell wrote:
> The first one is the one the raises an exception for non-strings?

  Python 2.6.1 (r261:67515, Dec  7 2008, 21:12:01)
  [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> u""+1
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: coercing to Unicode: need string or buffer, int found

Stefan



More information about the lxml-dev mailing list