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: 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: References: Date: Sun, 22 Dec 2013 13:30:14 +0100 Subject: Re: unicode to human readable format From: =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sun, Dec 22, 2013 at 1:24 PM, wrote: > Hi, > i'm looking for solution the unicode string translation to the more reada= ble format. > I've got string like s=3Ds=3D[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=E2=80=99s re= pr, Python shows a nice human-friendly representation. >>> s=3D[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] =C4=85=C5=BC=C4=99=C5=82=C5=84 However, that is only the case with Python 2, as Python 3 has a human-friendly representation in the repr, too: >>> s=3D[u'\u0105\u017c\u0119\u0142\u0144'] >>> s ['=C4=85=C5=BC=C4=99=C5=82=C5=84'] --=20 Chris =E2=80=9CKwpolska=E2=80=9D Warrick PGP: 5EAAEA16 stop html mail | always bottom-post | only UTF-8 makes sense