def list_pictures(directory, ext='jpg|jpeg|bmp|png|ppm'):
    return [os.path.join(root, f) for (root, _, files) in os.walk(directory) for f in files if re.match((('([\\w]+\\.(?:' + ext) + '))'), f)]
def list_pictures(directory, ext='jpg|jpeg|bmp|png|ppm'):
    return [os.path.join(root, f) for (root, _, files) in os.walk(directory) for f in files if re.match((('([\\w]+\\.(?:' + ext) + '))'), f)]