Strings show as brackets with a 'u'.

Dan Stromberg drsalists at gmail.com
Sat Jul 23 20:52:16 EDT 2011


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')

On Sat, Jul 23, 2011 at 5:33 PM, goldtech <goldtech at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110723/d415203c/attachment-0001.html>


More information about the Python-list mailing list