Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62530

Re: unicode to human readable format

From Peter Otten <__peter__@web.de>
Subject Re: unicode to human readable format
Date 2013-12-22 13:33 +0100
Organization None
References <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4492.1387715621.18130.python-list@python.org> (permalink)

Show all headers | View raw


tomasz.kaczorek@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
... 
ążęłń

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

unicode to human readable format tomasz.kaczorek@gmail.com - 2013-12-22 04:24 -0800
  Re: unicode to human readable format Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-12-22 13:30 +0100
  Re: unicode to human readable format Peter Otten <__peter__@web.de> - 2013-12-22 13:33 +0100
  Re: unicode to human readable format tomasz.kaczorek@gmail.com - 2013-12-27 02:43 -0800
    Re: unicode to human readable format Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-27 22:37 +1100
      Re: unicode to human readable format wxjmfauth@gmail.com - 2013-12-27 23:48 -0800
    Re: unicode to human readable format Ned Batchelder <ned@nedbatchelder.com> - 2013-12-27 06:47 -0500
    Re: unicode to human readable format Dave Angel <davea@davea.name> - 2013-12-27 06:59 -0500

csiph-web