Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created March 10, 2017 03:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithweaver/b113801cd38a354b06a4ad59e3c14a7f to your computer and use it in GitHub Desktop.
Save keithweaver/b113801cd38a354b06a4ad59e3c14a7f to your computer and use it in GitHub Desktop.
Check if file exists with Python
import os
def doesFileExists(filePathAndName):
return os.path.exists(filePathAndName)
# Example
if doesFileExists('./test.json'):
print ('Yaa it exists!')
else:
print ('Nope! Not around')
@rashidalmarri21
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment