Для байтового символа есть chr() и “%с”, а для юникода? Ок, есть unichr(), а форматная строка?
>>> s = u'abc' >>> type(s) <type 'unicode'> >>> print 'unicode - %s' % (s,) unicode - abc
Python 2.7.3 In [1]: '%c' % 123 Out[1]: '{' In [2]: u'%c' % 123 Out[2]: u'{' In [3]: u'%c' % 0x439 Out[3]: u'\u0439' In [4]: print u'%c' % 0x439 й In [5]: '%c' % 0x439 --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) ----> 1 '%c' % 0x439 OverflowError: unsigned byte integer is greater than maximum
Python 3.2.2 >>> '%c' % 0x0439 'й' >>> '%c' % 123 '{' >>>