Advertisements
Advertisements
प्रश्न
When are the following built-in exceptions raised? Give examples to support your answer.
ImportError
टीपा लिहा
Advertisements
उत्तर
It is raised when the requested module definition is not found.
>>> import maths
Traceback (most recent call last):
File "", line 1, in
import maths
ModuleNotFoundError: No module named 'maths'
>>> import randoms
Traceback (most recent call last):
File "", line 1, in
import randoms
ModuleNotFoundError: No module named 'randoms'
import maths #Raise an ImportError, due to maths module does not exists.
shaalaa.com
Built-in Exceptions in Python
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
