This is part of a short script I wrote to find out whether students had submitted any corrections to work in December or January.
import os, os.path
months = ['Dec', 'Jan'] # actually a raw_input()
files = get_all_files(root_dir) # actually a call to os.path.walk()
dates = []
for i in files:
for j in months:
if j in i: # filenames have date-stamp on them
dates.append(i)
break
In other words, dates ends up with all of the files whose names contain any of the items in months.
Can this be done with list comprehension?
Doesn't work:
dates =
Jeff