[Tutor] unicode mapping doesn't work
Albert-Jan Roskam
fomcl at yahoo.com
Thu Nov 26 17:02:27 CET 2009
Hi,
I want to substitute some letters with accents with theire non-accented equivalents. It should be easy, but it doesn't work. What am I doing wrong?
trans = {}
funnychars = u"éèêëóòôöáàâäÉÈÊËÓÒÔÖÁÀÂÄ"
asciichars = "eeeeooooaaaaEEEEOOOOAAAA"
for f, a in zip(funnychars, asciichars):
trans.update({f: a})
print funnychars.translate(trans) # why doesn't this return the letters without accents?
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the face of ambiguity, refuse the temptation to guess.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091126/e2d08bee/attachment.htm>
More information about the Tutor
mailing list