Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created March 10, 2017 03:49
Show Gist options
  • 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')
@Bojackson123
Copy link

Thanks!

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