Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62529
| References | <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com> |
|---|---|
| Date | 2013-12-22 13:30 +0100 |
| Subject | Re: unicode to human readable format |
| From | Chris “Kwpolska” Warrick <kwpolska@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4491.1387715422.18130.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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