______ is raised when the file specified in a program statement cannot be opened.
______ is raised when the file specified in a program statement cannot be opened.
Solution
IOError is raised when an input/output operation fails, including when the file named in an open() statement cannot be opened (for example, the file does not exist or permission is denied).
In Python 3, IOError is an alias of OSError, and the more specific FileNotFoundError is a subclass of it.
EOFError: raised when input() reaches the end of input without reading any data, not when a file fails to open.
ImportError: raised when an import statement cannot find or load a module.
ValueError: raised when a function gets an argument of the right type but an unsuitable value, such as int("abc").
Related questions:
2026: 24 May Shift 1
2025: 15 May Shift 2
2026: 24 May Shift 1