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


Groups > comp.lang.python > #10181

Re: Strings show as brackets with a 'u'.

References <d3c602cf-8a80-4035-9478-22d9b00022c2@r5g2000prf.googlegroups.com>
Date 2011-07-24 10:52 +1000
Subject Re: Strings show as brackets with a 'u'.
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1407.1311468776.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Jul 24, 2011 at 10:33 AM, goldtech <goldtech@worldpost.com> wrote:
>
>  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.

There's two things there. Firstly, your regex is returning a list, not
a string; and secondly, you are seeing repr(n) instead of just its
content. Try:
>>> print(n[0])

This should print just the value.

(Pro tip: rantingrick is a troll. You can safely ignore him.)

Chris Angelico

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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