Created
May 23, 2014 14:15
-
-
Save akiniwa/2f905804a7447bf4faa1 to your computer and use it in GitHub Desktop.
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 glob | |
import os | |
os.chdir("/mydir") | |
for file in glob.glob("*.txt"): | |
print file | |
import os | |
for file in os.listdir("/mydir"): | |
if file.endswith(".txt"): | |
print file | |
import os | |
for root, dirs, files in os.walk("/mydir"): | |
for file in files: | |
if file.endswith(".txt"): | |
print os.path.join(root, file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment