Created
April 14, 2018 17:29
-
-
Save Fhernd/3c36b1eb3c94ea3a3afd72416d0395ab to your computer and use it in GitHub Desktop.
Búsqueda coincidencia más corta.
This file contains 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 | |
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