Given the following piece of python code:
for root, dirs, files in os.walk(directory): for filename in fnmatch.filter(files, \'*.png\'): pass
This isn't really elegant either, but it works:
for root, dirs, files in os.walk(directory): for filename in fnmatch.filter(files, '*.png') + fnmatch.filter(files, '*.jpg') + fnmatch.filter(files, '*.jpeg') + fnmatch.filter(files, '*.gif'): pass