Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created April 14, 2018 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/3c36b1eb3c94ea3a3afd72416d0395ab to your computer and use it in GitHub Desktop.
Save Fhernd/3c36b1eb3c94ea3a3afd72416d0395ab to your computer and use it in GitHub Desktop.
Búsqueda coincidencia más corta.
import re
patron_busqueda = re.compile(r'\"(.*)\"')
cadena_texto = 'Python es "génial".'
print(patron_busqueda.findall(cadena_texto))
print('')
cadena_texto = 'Python es "génial". Apto para "machine learning".'
# Uso operador ?:
patron_busqueda = re.compile(r'\"(.*?)\"')
print(patron_busqueda.findall(cadena_texto))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment