Skip to content

Instantly share code, notes, and snippets.

@david-botelho-mariano
Last active October 31, 2019 19:07
Show Gist options
  • Save david-botelho-mariano/8a9a1879259b8e1771a2a5f5185bb6c0 to your computer and use it in GitHub Desktop.
Save david-botelho-mariano/8a9a1879259b8e1771a2a5f5185bb6c0 to your computer and use it in GitHub Desktop.
Regex de string em python
#regex de string
def get_string(variavel, inicio, fim):
variavel_array_primario = variavel.split(inicio)
variavel_array_secundario = variavel_array_primario[1].split(fim)
resultado = variavel_array_secundario[0]
return resultado
frase = "GitHub brings together the world's largest community of developers to discover, share, and build better software"
frase_filtrada = get_string(frase, 'together', 'to')
print(frase_filtrada)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment