Skip to main content

How to remove accentuated characters from a string with Python

·39 words·1 min

How to remove accentuated characters from a string with Python
#

Easy :

output = unicodedata.normalize('NFKD', input).encode('ASCII', 'ignore')

If your input string is not unicode, you’ll have to convert it first :

output = unicodedata.normalize('NFKD', unicode (input, 'utf-8')).encode('ASCII', 'ignore')