convert unicode characters to visibly similar ascii characters
Laszlo Nagy
gandalf at shopzeus.com
Tue Jul 1 15:16:57 EDT 2008
Peter Bulychev wrote:
> Thank you for you answer.
>
> If you only want this to work for a subset, please define that subset.
>
> Actually, I want to convert only punctuations (dots, commas, hyphens
> and so on).
Then make your translation table manually and apply this method:
unicode.translate
Finally
print s.encode('ascii')
If you get an UnicodeEncodeError then it means you had other (not
translated, non-ascii) characters in the original string.
Best,
Laszlo
More information about the Python-list
mailing list