Basic

[ my_result for my_result in my_iterable ]

With a function:

import glob2, os, pandas as pd def process(file_name): pp= [] pp['filename'] = file_name pp['last_modified'] = os.path.getmtime(file_name) return pp

listing = [ process(x) for x in glob2.iglob('*.md') ] df = pd.DataFrame(listing)

Filter list

With list generation (pythonic way)

lines = [ x for x in results if x.startswith('[') ]

With map/filter/lambda

lines = list(filter(lambda x: x.startswith('['), results))