Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10182
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <t@jollybox.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'newbie': 0.03; 'string.': 0.04; 'suppress': 0.07; 'python': 0.08; 'subject:show': 0.09; 'wrote:': 0.15; 'assigns': 0.16; 'brackets': 0.16; 'received:192.168.1.40': 0.16; "subject:'.": 0.16; 'variable.': 0.16; 'pm,': 0.16; '>>>': 0.16; '2.x': 0.19; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'assume': 0.23; 'string': 0.26; 'tried': 0.27; "i'm": 0.27; 'url:mailman': 0.27; 'sat,': 0.28; 'script': 0.29; 'idle': 0.29; 'shell': 0.29; 'unicode': 0.29; 'do.': 0.30; 'hi,': 0.31; 'url:listinfo': 0.32; 'print': 0.32; 'list': 0.32; "i've": 0.33; 'to:addr:python-list': 0.34; 'header :User-Agent:1': 0.34; 'there': 0.34; 'appreciated': 0.34; 'probably': 0.35; 'question': 0.35; 'url:python': 0.37; 'useful': 0.37; 'element': 0.37; 'pull': 0.37; 'some': 0.37; 'but': 0.37; 'using': 0.37; 'received:192': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'data': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'received:62': 0.67; 'show': 0.67; '2.7.': 0.84; 'encoding,': 0.84; 'from:addr:t': 0.84; 'stuff:': 0.84 |
| Date | Sun, 24 Jul 2011 03:06:09 +0200 |
| From | Thomas Jollans <t@jollybox.de> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Strings show as brackets with a 'u'. |
| References | <d3c602cf-8a80-4035-9478-22d9b00022c2@r5g2000prf.googlegroups.com> <CAGGBd_qOfUV=DbHT6CW8EWJohxCS5e=-Kx07m_YdDj==G0zUkQ@mail.gmail.com> |
| In-Reply-To | <CAGGBd_qOfUV=DbHT6CW8EWJohxCS5e=-Kx07m_YdDj==G0zUkQ@mail.gmail.com> |
| X-Enigmail-Version | 1.1.2 |
| OpenPGP | id=5C8691ED |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1408.1311469574.1164.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1311469574 news.xs4all.nl 23904 [2001:888:2000:d::a6]:50281 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10182 |
Show key headers only | View raw
On 24/07/11 02:52, Dan Stromberg wrote:
>
> It's probably a list containing a single unicode string.
>
> You can pull the first element from the list with n[0].
>
> To print a unicode string in 2.x without the u stuff:
>
> print u'174'.encode('ISO-8859-1')
just
>>> print u'174'
will do.
Encoding the string by hand is only useful if Python doesn't know the
terminal's encoding, but you do.
>
> On Sat, Jul 23, 2011 at 5:33 PM, goldtech <goldtech@worldpost.com
> <mailto:goldtech@worldpost.com>> wrote:
>
>
> Hi,
>
> >>> n
> [u'174']
> >>>
>
> Probably newbie question but not sure how suppress the brackets and
> the 'u' ? I assume pyhon is telling me it's a unicode string in the n
> variable.
>
> I'm using using Idle on winXP, activestate 2.7. Is there a way to
> suppress this and just show 174 in the shell ?
> A script reading data and assigns 174 to n via some regex. Links on
> this appreciated - I've tried to understand unicode before, will keep
> trying...thanks.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Strings show as brackets with a 'u'. goldtech <goldtech@worldpost.com> - 2011-07-23 17:33 -0700
Re: Strings show as brackets with a 'u'. rantingrick <rantingrick@gmail.com> - 2011-07-23 17:48 -0700
Re: Strings show as brackets with a 'u'. Chris Angelico <rosuav@gmail.com> - 2011-07-24 10:52 +1000
Re: Strings show as brackets with a 'u'. Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-07-25 10:00 +0200
Re: Strings show as brackets with a 'u'. rantingrick <rantingrick@gmail.com> - 2011-07-26 17:33 -0700
Re: Strings show as brackets with a 'u'. Thomas Jollans <t@jollybox.de> - 2011-07-24 03:06 +0200
Re: Strings show as brackets with a 'u'. goldtech <goldtech@worldpost.com> - 2011-07-26 18:18 -0700
Re: Strings show as brackets with a 'u'. Terry Reedy <tjreedy@udel.edu> - 2011-07-26 23:04 -0400
Re: Strings show as brackets with a 'u'. goldtech <goldtech@worldpost.com> - 2011-07-27 16:37 -0700
Re: Strings show as brackets with a 'u'. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-27 14:20 +1000
csiph-web