All pastes #966940 Raw Edit

Miscellany

public python v1 · immutable
·published 2008-04-02 02:51 UTC
rendered paste body
result_found = any(['foo' in x for x in os.listdir('something') if os.path.isfile(x)])# The above is the same as what is belowresults = []for entry in os.listdir('something'):    if os.path.isfile(entry):        if 'foo' in entry:            results.append(True)        else:            results.append(False)