fork download
  1. import re
  2.  
  3. file_list = ['20150301',
  4. '20150301100.tar.gz',
  5. '20150302',
  6. '20150302100.tar.gz',
  7. '20150303',
  8. '20150303100.tar.gz']
  9. matchOB = [x for x in file_list if re.search(r"^\d+$", x)]
  10. print(matchOB)
Success #stdin #stdout 0.01s 9024KB
stdin
Standard input is empty
stdout
['20150301', '20150302', '20150303']