On Wed, Oct 13, 2010 at 4:01 AM, Alan Gauld <alan.ga...@btinternet.com>wrote:
> "David Hutto" <smokefl...@gmail.com> wrote > > Below is the output before converting: >> >> [(u'.hjvkjgfkj/bdgfkjbg', u''), (u'bbbbbbbbbbbbuuzzzzzzzzz', u'Pie >> Chart'), (u'jgkgyckghc', u''), (u'kfhhv ', u''), (u'khfhf', u''), >> (u'test', u''), (u'test10', u''), (u'test2', u'Dashed/Dotted'), >> (u'test3', u'Pie Chart'), (u'test346w43', u''), (u'test4', u'Scatter >> Plot'), (u'test5', u''), (u'test6', u''), (u'test7', u''), >> (u'test7uyuy', u''), (u'test8', u''), (u'test9', u''), (u'testgraph', >> u''), (u'u;s;juf;sfkh', u''), (u'zzrerhshhjrs', u'')] >> > > And there is the answer to your question. > The string that you thought started with ; actually starts with a 'u' > But you strip the 'u;' off that entry so it appears to be badly ordered. > > So the next question is why do you strip the 'u' off? > > I suspect the answer to that also lies here. > I suspect you think you need to strip all the 'u's from the front of > these results but in fact those 'u's lie outside the string, they > are a part of Python's representation of a unicode string, > not a part of the string. > > So if you remove the call to strip() your code will return > the result you expected. > > > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > Not to belabor the point too much, I plucked one of your strings out and printed it. Looking at your data, all those u' prefixes you thought you were removing were (in a sense) never really there! The only u you removed was the one near the end that was followed with a semicolon. print u'zzrerhshhjrs' zzrerhshhjrs -- Joel Goldstick
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor