e check the file name.")
  </pre>
      </div>
      <h3>Output:</h3>
      <p>
        Instead of crashing, the program will display:
      </p>
      <pre>
The file does not exist. Please check the file name.
</pre>

      <h3>Example 3: Use the <code>with</code> Statement</h3>
      <p>
        A better way to open files is by using the <code>with</code> statement. This ensures the file is automatically
        closed after its use:
      </p>
      <div class="code-block">
        <pre>
# Using 'with' t