Created
October 17, 2016 18:43
-
-
Save marceloleiva/00121896d2a65c3c2a6c6f31d8c9d5e9 to your computer and use it in GitHub Desktop.
Buscar texto con re created by marceloleiva - https://repl.it/Dy6x/1
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 | |
texto = 'Supermercado (1,10,5)' | |
busqueda_coordenada = re.search(r'(.+)(\(.{5,}\))', texto) | |
print(busqueda_coordenada.groups()) | |
if busqueda_coordenada: | |
if len(busqueda_coordenada.groups()) >= 2: | |
texto = busqueda_coordenada.group(1).strip() | |
coordenada = re.sub('[()]', '', busqueda_coordenada.group(2)).split(',') | |
print(texto) | |
print(coordenada) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment