apex1
Regular Member
- May 29, 2015
- 217
- 182
Hey guys, here's my code so far:
It will output a list of image names from within the folder, example:
img1.jpg
img2.jpg
img3.jpg
But I can't get the damn thing to just tell me there are "3" images.
I tried using sum() and some other things but no luck.
Also, for some reason I can't add more image types on this line:
^This throws an error.
Any ideas how to fix it?
Code:
for img_scan in os.listdir('./test_folder'):
if img_scan.endswith('.jpg'):
print(str(img_scan))
It will output a list of image names from within the folder, example:
img1.jpg
img2.jpg
img3.jpg
But I can't get the damn thing to just tell me there are "3" images.
I tried using sum() and some other things but no luck.
Also, for some reason I can't add more image types on this line:
Code:
if img_scan.endswith('.jpg', '.jpeg', '.png', '.gif'):
^This throws an error.
Any ideas how to fix it?