R. David Murray <rdmur...@bitdance.com> added the comment: In python3:
>>> locale.setlocale(locale.LC_NUMERIC, "cs_CZ.UTF-8") 'cs_CZ.UTF-8' >>> s = format(Decimal("-1.5"), ' 019.18n') >>> len(s) 20 >>> print(s) -0 000 000 000 001,5 Python3 uses unicode for strings. Python2 uses bytes. To format unicode in python2, you do: >>> s2 = locale.format("% 019.18g", Decimal("-1.5")) >>> len(s2) 19 >>> print s2 -0000000000000001,5 Not quite the same thing, clearly. So, is there a way to access the python3 unicode format semantics in python2? Just passing format a unicode format string results in a UnicodeDecodeError. ---------- nosy: +r.david.murray priority: -> normal type: -> behavior versions: +Python 2.6, Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7327> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com