Advertisements
Advertisements
Question
When are the following built-in exceptions raised? Give examples to support your answer.
IOError
Short/Brief Note
Advertisements
Solution
It is raised when the file specified in a program statement cannot be opened.
>>> f = open("abc.txt",'r')
Traceback (most recent call last):
File "", line 1, in
f = open("abc.txt",'r')
FileNotFoundError: [Errno 2] No such file or directory: 'abc.txt'shaalaa.com
Built-in Exceptions in Python
Is there an error in this question or solution?
