Created
October 2, 2019 17:48
-
-
Save DataSolveProblems/84c136c9bcab9990698d16b574429688 to your computer and use it in GitHub Desktop.
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
import os | |
myFile = 'a file.txt' | |
def dir_check(input_dir): | |
if os.path.isdir(input_dir): | |
print(input_dir + ' is a folder') | |
return 1 | |
elif os.path.isfile(input_dir): | |
print(input_dir + ' is a file') | |
return 2 | |
else: | |
print(input_dir + ' does not exist') | |
return 3 | |
print(dir_check(myFile)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment