> sorry for a newbie question. I have unicode string (or better say
> latin2 encoding) containing non-ascii characters, e.g.
>
> s = "Ukázka_možnosti_využití_programu_OpenJUMP_v_SOA"
That's not a Unicode string (at least in Python 2); it is
a latin-2 encoded byte string; it has nothing to do with Unicode.
> I would like to convert this string to plain ascii (using some lookup
> table for latin2)
>
> to get
>
> -> Ukazka_moznosti_vyuziti_programu_OpenJUMP_v_SOA
I recommend to use string.translate. You need a translation
table there, which is best generated with string.maketrans.
table=string.maketrans("áží","azi")
print s.translate(table)
HTH,
Martin
--
http://mail.python.org/mailman/listinfo/python-list