Skip to content

Instantly share code, notes, and snippets.

@jmquintana79
Last active April 19, 2024 08:29
Show Gist options
  • Save jmquintana79/3b9a3eac5caa5fd33b77508d0022c3c9 to your computer and use it in GitHub Desktop.
Save jmquintana79/3b9a3eac5caa5fd33b77508d0022c3c9 to your computer and use it in GitHub Desktop.
import os
if os.path.isfile("filename.txt"):
# file exists
f = open("filename.txt")
if os.path.isdir("data"):
# directory exists
if os.path.exists(file_path):
# file or directory exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment