Unicode char replace

D

DiMar

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.u'Macworld \xbb Jobs 1 - Twitter 0'

2.'Macworld » Jobs 1 - Twitter 0'

None of them gives me 'Macworld » Jobs 1 - Twitter 0'

Any idea?

Thanks!
 
M

Michael Goerz

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.
u'Macworld \xbb Jobs 1 - Twitter 0'
How about this?
string.replace(u'\xbb', u'»')
 
D

DiMar

May I ask why?

Of course! I have to find that string into a list of strings. This
list includes one, using »
Thanks! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top