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


Groups > comp.lang.python > #62530

Re: unicode to human readable format

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'string': 0.09; 'converted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'translation': 0.12; 'readable': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'repr()': 0.16; 'skip:[ 30': 0.16; 'subject:format': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'unicode': 0.24; "i've": 0.25; 'help!': 0.26; 'header:X-Complaints-To:1': 0.27; 'idea': 0.28; "i'm": 0.30; 'skip:s 30': 0.35; 'no,': 0.35; 'format.': 0.36; 'hi,': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'email addr:gmail.com': 0.63; 'more': 0.64; 'ambiguous': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: unicode to human readable format
Date Sun, 22 Dec 2013 13:33:37 +0100
Organization None
References <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Gmane-NNTP-Posting-Host p508492c4.dip0.t-ipconnect.de
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4492.1387715621.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387715621 news.xs4all.nl 2897 [2001:888:2000:d::a6]:52964
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62530

Show key headers only | 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