Strings show as brackets with a 'u'.

Chris Angelico rosuav at gmail.com
Sat Jul 23 20:52:47 EDT 2011


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



More information about the Python-list mailing list