Python: Using .format() on a Unicode-escaped string
Just make the second string also a unicode string
>>> s = u'\u2265'
>>> print s
≥
>>> print "{0}".format(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2265' in position 0: ordinal not in range(128)
>>> print u"{0}".format(s)
≥
>>>
unicode
s need unicode
format strings.
>>> print u'{0}'.format(s)
≥