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


Groups > comp.lang.python > #62529

Re: unicode to human readable format

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwpolska@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'skip:u 30': 0.07; 'utf-8': 0.07; 'string': 0.09; '22,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'translation': 0.12; 'readable': 0.16; 's[0]': 0.16; 'skip:[ 30': 0.16; 'subject:format': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'string,': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'help!': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'sense': 0.34; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'format.': 0.36; 'url:listinfo': 0.36; 'shows': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'skip:[ 10': 0.38; 'pm,': 0.38; 'url:mail': 0.40; 'how': 0.40; 'from:charset:utf-8': 0.61; 'more': 0.64; 'skip:\xe2 10': 0.65; 'to:addr:gmail.com': 0.65; '8bit%:43': 0.74; 'url:tk': 0.95; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=d24Xddc5EcLAHefGwtNXCp2zGaxbIyGNaNJ23/OEZN4=; b=FUQDvBWcXSuOsk6iM18/OBjFkSO8QuqC5uPrMG0CS88pUY4GyioNPL6QLFwlUrWRPM OtDgBsbfk0KqiKXF6XM50IQqUVGNQRADDWD7UbY8bv9G508+/RDUK3UDQ28PWSy/tl/p +cMrb+YQjR/508+RAn/ouskDbD7W6ooFUUoajKMz8hCmrZ7IrPja3XhMAALjuFXGRLr4 b7rXQLJCA6wiqi91/Jn8YgZv5Mi9IIa9bVgmXWQEnGYZlLVGGW00yzKMGFgjj1Qi1802 B3iY9TXsYyyrEJIPySdTRxT6IRrE+Ju/dTcr4dKqnRgVDVRQ9LiQNSMMsgU4dm6bfehm V64w==
MIME-Version 1.0
X-Received by 10.42.148.200 with SMTP id s8mr335032icv.67.1387715414692; Sun, 22 Dec 2013 04:30:14 -0800 (PST)
In-Reply-To <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com>
References <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com>
Date Sun, 22 Dec 2013 13:30:14 +0100
Subject Re: unicode to human readable format
From Chris “Kwpolska” Warrick <kwpolska@gmail.com>
To tomasz.kaczorek@gmail.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.4491.1387715422.18130.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387715422 news.xs4all.nl 2929 [2001:888:2000:d::a6]:50417
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62529

Show key headers only | View raw


On Sun, Dec 22, 2013 at 1:24 PM,  <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!
>
> regards,
> tomasz
> --
> https://mail.python.org/mailman/listinfo/python-list

While printing the string, instead of the list/seeing the list’s repr,
Python shows a nice human-friendly representation.

>>> s=[u'\u0105\u017c\u0119\u0142\u0144']
>>> s
[u'\u0105\u017c\u0119\u0142\u0144']
>>> s[0]
u'\u0105\u017c\u0119\u0142\u0144'
>>> print s
[u'\u0105\u017c\u0119\u0142\u0144']
>>> print s[0]
ążęłń

However, that is only the case with Python 2, as Python 3 has a
human-friendly representation in the repr, too:

>>> s=[u'\u0105\u017c\u0119\u0142\u0144']
>>> s
['ążęłń']

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense

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