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
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
