[Zope] Replacing an unicode string

Dieter Maurer dieter at handshake.de
Tue Aug 26 00:02:09 EDT 2003


Florian Reiser wrote at 2003-8-25 11:24 +0200:
 > I have an unicode string:
 > 
 > text = u'ABC<EURO>'
 > 
 > Now I want to do a replacement of the string u'<EURO>' to u'\u20ac'
 > (this is the euro sign).
 > When I type
 > 
 > text = text.replace(u'<EURO>', u'\u20ac')
 > 
 > nothing happens, the string is still u'ABC<EURO>'
 > How can I replace the tag '<EURO>' and insert the euro sign instead?

Works for me: Python 2.1.3. Done in an interactive interpreter.


Dieter



More information about the Zope mailing list