This is true for all built-in exceptions, but need not be trueįor user-defined exceptions (although it is a useful convention). The string printed as the exception type is the name of the built-in exception The example are ZeroDivisionError, NameError and TypeError. Exceptions come inĭifferent types, and the type is printed as part of the message: the types in The last line of the error message indicates what happened. 10 * ( 1 / 0 ) Traceback (most recent call last):įile "", line 1, in ZeroDivisionError: division by zero > 4 + spam * 3 Traceback (most recent call last):įile "", line 1, in NameError: name 'spam' is not defined > '2' + 2 Traceback (most recent call last):įile "", line 1, in TypeError: can only concatenate str (not "int") to str
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |