юникодом?
как его в строку?
In [1]: a = u"\u0418\u0432\u0430\u043d\u043e\u0432 \u0412\u0438\u0442\u0430\u04
...: 3b\u0438\u0439 \u0418\u0432\u0430\u043d\u043e\u0432\u0438\u0447"
In [2]: type(a)
Out[2]: unicode
In [3]: str(a)
---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
<ipython-input-3-bddfa438ffc2> in <module>()
----> 1 str(a)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
In [4]: print(a)
Иванов Виталий Иванович
In [5]: a.encode('utf-8')
Out[5]: '\xd0\x98\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xbe\xd0\xb2 \xd0\x92\xd0\xb8\xd1\x82\xd0\xb0\xd0\xbb\xd0\xb8\xd0\xb9 \xd0\x98\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xbe\xd0\xb2\xd0\xb8\xd1\x87'
In [6]: type(a.encode('utf-8'))
Out[6]: str
from __future__ import unicode_literals
Обсуждают сегодня