Unicode char replace
Hi all, I have this unicode string: string = u'Macworld » Jobs 1 - Twitter 0' and I want to replace the '»' (aka \xbb) char to '»'. I've tried 2 ways: 1. >>> string2 = string.replace('\\xbb','»') u'Macworld \xbb Jobs 1 - Twitter 0' 2. >>> import cgi >>> string2 = cgi.escape(string).encode("ascii", "xmlcharrefreplace") >>> string2 'Macworld » Jobs 1 - Twitter 0' None of them gives me 'Macworld » Jobs 1 - Twitter 0' Any idea? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode char replace
On 12 Feb, 22:11, Michael Goerz <[EMAIL PROTECTED]> wrote: > How about this? > string.replace(u'\xbb', u'»') Thanks, it works!!! DiMar -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode char replace
> May I ask why? Of course! I have to find that string into a list of strings. This list includes one, using » Thanks! :) -- http://mail.python.org/mailman/listinfo/python-list