I wrote the following code:
import fnmatch
ll = []
for items in src:
for file in os.listdir('/Users/swaghccc/Downloads/PulledImages/'):
if fnmatch.fnmatch(file, items.split('/')[-1]):
print file
ll.append(file)
my src
list contains paths to images.
something like:
/path/to/image.jpg
These images are a subset of the images contained in the directory PulledImages
.
The printing of the matched images works correctly.
But when I try to put those imagesnames into a list ll
it takes forever.
What on earth am I doing wrong?