HOME/Articles/

python code file exists 1 (snippet)

Article Outline

Python example 'python code file exists 1'

python code file exists 1

Python code example: python code file exists 1

# Brute force with a try-except block (Python 3+)
try: 
  with open('/path/to/file', 'r') as fh: 
    pass
except FileNotFoundError: 
  pass

More Python: https://pythonprogramminglanguage.com