Skip to content

Instantly share code, notes, and snippets.

@marceloleiva
Created October 17, 2016 18:43
Show Gist options
  • Save marceloleiva/00121896d2a65c3c2a6c6f31d8c9d5e9 to your computer and use it in GitHub Desktop.
Save marceloleiva/00121896d2a65c3c2a6c6f31d8c9d5e9 to your computer and use it in GitHub Desktop.
Buscar texto con re created by marceloleiva - https://repl.it/Dy6x/1
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