Advertisement
Fhernd

coincidencia-mas-corta.py

Apr 14th, 2018
2,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import re
  2.  
  3. patron_busqueda = re.compile(r'\"(.*)\"')
  4.  
  5. cadena_texto = 'Python es "génial".'
  6.  
  7. print(patron_busqueda.findall(cadena_texto))
  8.  
  9. print('')
  10.  
  11. cadena_texto = 'Python es "génial". Apto para "machine learning".'
  12.  
  13. # Uso operador ?:
  14. patron_busqueda = re.compile(r'\"(.*?)\"')
  15.  
  16. print(patron_busqueda.findall(cadena_texto))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement