Created
March 10, 2017 03:49
-
-
Save keithweaver/b113801cd38a354b06a4ad59e3c14a7f to your computer and use it in GitHub Desktop.
Check if file exists 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 | |
def doesFileExists(filePathAndName): | |
return os.path.exists(filePathAndName) | |
# Example | |
if doesFileExists('./test.json'): | |
print ('Yaa it exists!') | |
else: | |
print ('Nope! Not around') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!