Created
September 28, 2020 12:37
-
-
Save CGLion/033a6383bcaf8730c240899afb3d526d to your computer and use it in GitHub Desktop.
Python - Lists all files with specific extension in folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import listdir | |
from os.path import isfile, join | |
dir = "D:\\" | |
files = [f for f in listdir(dir) if isfile(join(dir, f)) and f[-3:]=='jpg'] | |
for f in files: | |
print join(dir, f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment