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
> 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
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 '»'.
> I've tried 2 ways:
>
> 1.
string2 = string.replace('\\xbb','»')
> u'Macworld \xbb Jobs 1 - Twitter 0'
How
> string = u'Macworld » Jobs 1 - Twitter 0'
>
>
> None of them gives me 'Macworld » Jobs 1 - Twitter 0'
>
> Any idea?
So I assume you *want* it to produce ». May I ask why?
I really recommend that you use » instead.
In any case, you need to define your own error handler, such as
the one in
ht
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("asc