Decode it with the unicode-escape codec:
>>> a="Hello\u2026" >>> a.decode('unicode-escape') u'Hello\u2026' >>> print _ Hello…
This is because for a string other than Unicode, \u2026 not recognized, but instead is treated as a literal series of characters (to make it clearer, 'Hello\\u2026' ). You need to decode the screens, and a unicode-escape codec can do this for you.
Note that you can get unicode to recognize it in the same way by specifying the codec argument:
>>> unicode(a, 'unicode-escape') u'Hello\u2026'
But a.decode() method is more enjoyable.
Chris Morgan Apr 22 '12 at 13:59 2012-04-22 13:59
source share