Last active
September 18, 2019 19:24
-
-
Save ratmcu/23353460d01c566a89efe6c81036bbd2 to your computer and use it in GitHub Desktop.
generator to list file paths of files with the same extension. using os.walk
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
import os | |
extension = '.csv' | |
tree = os.walk('./dataset') | |
paths = sorted([os.path.join(f[0], name) for f in tree if len(f[2])!=0 for name in f[2] if os.path.splitext(name)[-1] == '.csv']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment