Chapter 11, python exception handling (11.3-11.6)------raise exception handling, assert exception handling, exception class BaseException, usage of keyword as

Table of contents

11.3 python’s raise exception handling
(1) characteristics of raise exception handling statement
(2) try except combined with raise
11.4 python’s assert exception handling
11.5 python’s exception class BaseException
11.6 usage of keyword as in python

11.3 Python 's raise exception handling

       Whether it is python's automatic exception prompt or the try except exception handling statement, the python interpreter can automatically identify the exception triggering condition and make an exception judgment. When we need to achieve a reminder or abnormal effect under special conditions, even if the problem caused by this special condition belongs to the category of exception class BaseException (or Exception), this special condition may not trigger the interpreter. Judging to generate reminders or abnormal effects, that is, it cannot satisfy a special response. Therefore, at this time, we need to manually define the trigger conditions for abnormal generation.

Guess you like

Origin blog.csdn.net/thefg/article/details/127994131