我是靠谱客的博主 忧郁火车,最近开发中收集的这篇文章主要介绍exception 种类,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

ExceptionDescription
AssertionErrorRaised when the assert statement fails.
AttributeErrorRaised on the attribute assignment or reference fails.
EOFErrorRaised when the input() function hits the end-of-file condition.
FloatingPointErrorRaised when a floating point operation fails.
GeneratorExitRaised when a generator’s close() method is called.
ImportErrorRaised when the imported module is not found.
IndexErrorRaised when the index of a sequence is out of range.
KeyErrorRaised when a key is not found in a dictionary.
KeyboardInterruptRaised when the user hits the interrupt key (Ctrl+c or delete).
MemoryErrorRaised when an operation runs out of memory.
NameErrorRaised when a variable is not found in the local or global scope.
NotImplementedErrorRaised by abstract methods.
OSErrorRaised when a system operation causes a system-related error.
OverflowErrorRaised when the result of an arithmetic operation is too large to be represented.
ReferenceErrorRaised when a weak reference proxy is used to access a garbage collected referent.
RuntimeErrorRaised when an error does not fall under any other category.
StopIterationRaised by the next() function to indicate that there is no further item to be returned by the iterator.
SyntaxErrorRaised by the parser when a syntax error is encountered.
IndentationErrorRaised when there is an incorrect indentation.
TabErrorRaised when the indentation consists of inconsistent tabs and spaces.
SystemErrorRaised when the interpreter detects internal error.
SystemExitRaised by the sys.exit() function.
TypeErrorRaised when a function or operation is applied to an object of an incorrect type.
UnboundLocalErrorRaised when a reference is made to a local variable in a function or method, but no value has been bound to that variable.
UnicodeErrorRaised when a Unicode-related encoding or decoding error occurs.
UnicodeEncodeErrorRaised when a Unicode-related error occurs during encoding.
UnicodeDecodeErrorRaised when a Unicode-related error occurs during decoding.
UnicodeTranslateErrorRaised when a Unicode-related error occurs during translation.
ValueErrorRaised when a function gets an argument of correct type but improper value.
ZeroDivisionErrorRaised when the second operand of a division or module operation is zero.

最后

以上就是忧郁火车为你收集整理的exception 种类的全部内容,希望文章能够帮你解决exception 种类所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部