fork download
  1. import re
  2. p = re.compile(r'(?m)^\t(.*)\t.*: (.*)$')
  3. test_str = " Location Next Available Appointment: Date\n Location1 Next Available Appointment: Date1\n"
  4. print [(x.group(1), x.group(2)) for x in re.finditer(p, test_str)]
Success #stdin #stdout 0.01s 7692KB
stdin
Standard input is empty
stdout
[('Location', 'Date'), ('Location1', 'Date1')]