Exception trong python.
Python cung cấp 2 tính năng rất quan trọng để handle những lỗi không mong muốn và thêm khả năng debug trong ứng dụng python của bạn. 1. Exception handling. 2. Assertions. Trong phần này ta chỉ chú trọng bào Exception handling. Danh sách các Exception tiêu chuẩn: EXCEPTION NAME DESCRIPTION Exception Base class for all exceptions StopIteration Raised when the next() method of an iterator does not point to any object. SystemExit Raised by the sys.exit() function. StandardError Base class for all built-in exceptions except StopIteration and SystemExit. ArithmeticError Base class for all errors that occur for numeric calculation. OverflowError Raised when a calculation exceeds maximum limit for a numeric type. FloatingPointError Raised when a floating point calculation fails. ZeroDivisonError Raised when division or modulo by zero takes place for all numeric types. AssertionError Raised in case of failure of the Assert statement. AttributeError Raised in case of failure