Last active
May 31, 2018 16:36
-
-
Save glwinsor/887aeddca4f8ce2d46f6b5ccbddcf2ed to your computer and use it in GitHub Desktop.
file or directory exists
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 | |
if not os.path.isfile("./file.txt"): | |
raise FileNotFoundError("Could not find ./file.txt") | |
if not os.path.isdir('./dir'): | |
raise FileNotFoundError("Could not find ./dir") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment