fork(1) download
  1. import re
  2.  
  3. sentence = '''
  4. Tue, 20 August 2019
  5. 17:30 - 21:00 CEST
  6. '''
  7. pattern = re.compile(r'\d\d:\d\d')
  8. cnt = 0
  9. wanted = [1,2]
  10.  
  11. for match in pattern.finditer(sentence):
  12. cnt += 1
  13. if cnt in wanted:
  14. print(match.group())
Success #stdin #stdout 0.02s 9560KB
stdin
Standard input is empty
stdout
17:30
21:00