Back to Lesson

FileNotFoundError

Attempt to open a non-existent file and gracefully handle the resulting error.

Instructions

  • Try to open
    "missing.txt"
    in
    "r"
    (read mode).
  • Catch the
    FileNotFoundError
    .
  • Print
    "File does not exist"
    inside the except block.
main.py
main.py