Created
October 3, 2019 15:57
-
-
Save cnmoro/baa2e99940f87b16aac998cccb23204a to your computer and use it in GitHub Desktop.
Python Remover Acentos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import unicodedata | |
def strip_accents(text): | |
try: | |
text = unicode(text, 'utf-8') | |
except (TypeError, NameError): | |
pass | |
text = unicodedata.normalize('NFD', text) | |
text = text.encode('ascii', 'ignore') | |
text = text.decode("utf-8") | |
return str(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment