fork download
  1. import re
  2.  
  3. a = '''"A-1 Cafe Restaurant","Mon, Wed-Sun 11 am - 10 pm"
  4. "Nick's Lighthouse","Mon-Sun 11 am - 10:30 pm"
  5. "Paragon Restaurant & Bar","Mon-Fri 11:30 am - 10 pm / Sat 5:30 pm - 10 pm"'''
  6.  
  7. text_which_we_fond = r"[\w.+]+-[A-Za-z-]+" # шаблон поиска
  8. reg = re.compile(text_which_we_fond)
  9. all_results = list(filter(reg.search, a.splitlines()))
  10.  
  11. for i in all_results:
  12. print (i)
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
"A-1 Cafe Restaurant","Mon, Wed-Sun 11 am - 10 pm"
"Nick's Lighthouse","Mon-Sun 11 am - 10:30 pm"
"Paragon Restaurant & Bar","Mon-Fri 11:30 am - 10 pm  / Sat 5:30 pm - 10 pm"