Skip to content

Instantly share code, notes, and snippets.

@becahp
Last active August 31, 2020 22:47
Show Gist options
  • Save becahp/69b5a80994cbe33ec971956a387496b2 to your computer and use it in GitHub Desktop.
Save becahp/69b5a80994cbe33ec971956a387496b2 to your computer and use it in GitHub Desktop.
clean a string
#!pip install Unidecode
import unidecode
def clean_string(str):
str = str.strip()
str = str.replace(" ","") #remover espaços
str = str.replace("'","") #remover apóstrofos
str = str.lower() #colocar tudo em minúsculas
str = unidecode.unidecode(str) #remover acentuação
return str
#exemplo
txt = "Nova Brasilândia D'Oeste oração"
clean_string(txt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment