Is it possible to append elements to a python generator?
I\'m currently trying to get all images from a set of disorganized folders and write them to a new directory
This should do it, where directories is your list of directories:
directories
import os import itertools generators = [os.walk(d) for d in directories] for root, dirs, files in itertools.chain(*generators): print root, dirs, files