Unicode char replace

Michael Goerz newsgroup898sfie at 8439.e4ward.com
Tue Feb 12 16:11:55 EST 2008


DiMar wrote, on 02/12/2008 09:54 PM:
> Hi all,
> 
> I have this unicode string:
> 
> string = u'Macworld » Jobs 1 - Twitter 0'
> 
> and I want to replace the '»' (aka \xbb) char to '&raquo'.
> I've tried 2 ways:
> 
> 1.
>>>> string2 = string.replace('\\xbb','»')
> u'Macworld \xbb Jobs 1 - Twitter 0'
How about this?
string.replace(u'\xbb', u'»')



More information about the Python-list mailing list