unicode to human readable format

Peter Otten __peter__ at web.de
Sun Dec 22 07:33:37 EST 2013


tomasz.kaczorek at gmail.com wrote:

> Hi,
> i'm looking for solution the unicode string translation to the more
> readable format. I've got string like
> s=s=[u'\u0105\u017c\u0119\u0142\u0144'] and have no idea how to change to
> the human readable format. please help!

No, you have a list of strings:

>>> list_of_strings = [u'\u0105\u017c\u0119\u0142\u0144']
>>> print list_of_strings
[u'\u0105\u017c\u0119\u0142\u0144']

When a list is printed the individual items are converted to strings with 
repr() to avoid ambiguous output e. g. for strings with embeded commas.

If you want human readable strings print them individually instead of the 
whole list at once:

>>> for string in list_of_strings:
...     print string
... 
ążęłń





More information about the Python-list mailing list