How can I replace non-ascii chars from a unicode string in Python?
This are the output I spect for the given inputs:
música -> musica
cartón -> carton
caño -> cano
Myaybe with a dict where 'á' is a key and 'a' a value?
If all you want to do is degrade accented characters to their non-accented equivalent:
>>> import unicodedata
>>> unicodedata.normalize('NFKD', u"m\u00fasica").encode('ascii', 'ignore')
'musica'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With