Created
May 30, 2017 15:17
-
-
Save asus4/03f82fe441b40e4319b13fe97f516265 to your computer and use it in GitHub Desktop.
Find specific extension files in directory (python)
This file contains hidden or 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
def fild_files(directory, file_ext): | |
''' Find specific extension files in the folder ''' | |
for root, dirs, files in os.walk(directory): | |
for file in files: | |
_, ext = os.path.splitext(file) | |
if ext == '.' + file_ext: | |
yield os.path.join(root, file) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment