Last active
August 1, 2020 21:58
-
-
Save victorono/7633010 to your computer and use it in GitHub Desktop.
Eliminar tildes string python
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import unicodedata | |
def elimina_tildes(cadena): | |
s = ''.join((c for c in unicodedata.normalize('NFD',unicode(cadena)) if unicodedata.category(c) != 'Mn')) | |
return s.decode() | |
string_acentos = 'café'.decode('utf-8') | |
sin_tildes = elimina_tildes(string_acentos) | |
print sin_tildes |
Buen script para eliminar tildes
Muy buen aporte, aquí una versión compatible con python 3.x
def elimina_tildes(cadena):
s = ''.join((c for c in unicodedata.normalize('NFD',cadena) if unicodedata.category(c) != 'Mn'))
return s
¡Excelente! Mil gracias. 😄
Muy útil
gracias, fue de gran ayuda :D
Gracias bro!!!
Gracias man, es muy útil.
Único inconveniente es que elimina la 'ñ'. Pero sigue siendo muy útil.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muchas gracias, fue muy util.