Last active
March 20, 2016 20:21
-
-
Save dagg/c4f89ddaf81f557b1dcc to your computer and use it in GitHub Desktop.
Check if something is file or dir with python
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 | |
x = os.listdir('.') #list of files in current dir | |
for i in x: | |
if os.path.isdir(i): | |
print i, 'is dir' | |
if os.path.isfile(i): | |
print i, 'is file' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment