fork(1) download
  1. import re
  2. date = '24 Jan 2016'
  3. def func(line):
  4. month_regex = re.search('(\d{1,2})\s(Jan(?:uary)?)\s(\d{2,4})', line)
  5. if month_regex:
  6. year = month_regex.group(3)
  7. return year
  8. print(func(date))
Success #stdin #stdout 0.02s 28520KB
stdin
Standard input is empty
stdout
2016