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

2011-07-27 Thread goldtech
> Rick gave you some good advice, perhaps worth re-reading. What you need > are investigative skills, and not just bits of data. Totally agree. beginning to see what's going on. I'm not specifically accessing the list element with n (vs. n[0]). Printing n uses repr which gives the unicode "tag".

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

2011-07-26 Thread Steven D'Aprano
On Wed, 27 Jul 2011 11:18 am goldtech wrote: > Thank you. So what is happening? Is it that I'm in an environment that > is not unicode and python is telling me the string (ie. n[0]) is > unicode? (I'll do a hatchet-job on this subject if I ask anymore about > unicode). Thanks to posters for their

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

2011-07-26 Thread Terry Reedy
On 7/26/2011 9:18 PM, goldtech wrote: Thank you. So what is happening? Is it that I'm in an environment that is not unicode and python is telling me the string (ie. n[0]) is unicode? Yes, n is a list and n[0] is a unicode string and you are using some 2.x, which is ascii/byte string based. Pyt

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

2011-07-26 Thread goldtech
Thank you. So what is happening? Is it that I'm in an environment that is not unicode and python is telling me the string (ie. n[0]) is unicode? (I'll do a hatchet-job on this subject if I ask anymore about unicode). Thanks to posters for their patience! -- http://mail.python.org/mailman/listinfo/

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

2011-07-26 Thread rantingrick
On Jul 25, 3:00 am, Ulrich Eckhardt wrote: > Chris Angelico wrote: > > > [snip] > > You just gave the OP a fish, he provided a > valuable advise on fishing itself. I always believed the best way to teach someone is not to give them a direct answer. No. Instead i like to offer clues so that the pe

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

2011-07-25 Thread Ulrich Eckhardt
Chris Angelico wrote: > On Sun, Jul 24, 2011 at 10:33 AM, goldtech 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 tri

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

2011-07-23 Thread Thomas Jollans
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. Encod

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

2011-07-23 Thread Chris Angelico
On Sun, Jul 24, 2011 at 10:33 AM, goldtech 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 bef

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

2011-07-23 Thread Dan Stromberg
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 wrote: > > Hi, > > >>> n > [u'174'] > >>> > > Prob

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

2011-07-23 Thread rantingrick
On Jul 23, 7:33 pm, goldtech wrote: > > >>> 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. Try type(n) and see what happens. Then report back. :) -- http://mail.python.org/ma