Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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