zoukankan      html  css  js  c++  java
  • python 标准异常总结

    AssertionError  断言语句   (assert)    失败

    AttributeError  尝试访问未知的对象属性

    EoFError   用户输入文件末尾标志EOF  (Ctrl+d)

    FloatingPoinError    浮点计算错误

    GeneratorExit generator.close() 方法被调用的时候

    ImportError   导入模块失败的时候

    IndexError 索引超出序列的范围

    KeyError  字典中查找一个不存在的关键字

    Keyboardlnterrupt  用户输入中断键   (ctrl+c)

    MemoryError   内存溢出  (可通过删除对象释放内存)

    NameError   尝试访问一个不存在的变量

    NotlmplementedError   尚未实现的方法

    OSError    操作系统产生的异常 (列如打开一个不存在的文件)

    OverflowError   数值运算超出最大限制

    ReferenceError  若引用 (weak  reference)  试图访问一个已经被垃圾回收机制回收的对象

    RuntimeError 一般的运行时错误

    Stoplteration  迭代器没有更多值

    SyntaxError  Python的语法错误

    IndentationError  缩进错误

    TabError  Tab和空格混合使用

    SystemError  不同类型间的无效操作

    UnboundLocaIError   访问一个未初始化的本地变量(NameError的子类)

    UnicodeError Unicode   相关的错误 (ValueError的子类)

    UnicodeEncodeError Unicode编码时的错误(UnicodeError的子类)

    UnicodeDecodeError Unicode解码时的错误(UnicodeError的子类) 

    UnicodeTranslateError Unicode转换时的错误(UnicodeError的子类) 

    ValueError 传入无效的参数

    ZeroDivisionError 除数为零

    以下是 Python 内置异常类的层次结构:BaseExceptionSystemExit

    KeyboardInterrupt
    GeneratorExit
    Exception
    StopIteration
    ArithmeticError
    FloatingPointError
    OverflowError
    ZeroDivisionError
    AssertionError
    AttributeError
    BufferError
    EOFError
    ImportError
    LookupError
    IndexError
    KeyError
    MemoryError
    NameError
    UnboundLocalError
    OSError
    BlockingIOError
    ChildProcessError
    ConnectionError
    BrokenPipeError
    ConnectionAbortedError
    ConnectionRefusedError
    ConnectionResetError
    FileExistsError
    FileNotFoundError
    InterruptedError
    IsADirectoryError
    NotADirectoryError
    PermissionError
    ProcessLookupError
    TimeoutError
    ReferenceError
    RuntimeError
    NotImplementedError
    SyntaxError
    IndentationError
    TabError
    SystemError
    TypeError
    ValueError
    UnicodeError
    nicodeDecodeError
    |UnicodeEncodeError
    UnicodeTranslateError
    Warning
    DeprecationWarning
    PendingDeprecationWarning
    RuntimeWarning
    SyntaxWarning
    UserWarning
    FutureWarning
    ImportWarning
    UnicodeWarning
    BytesWarning
    ResourceWarning

  • 相关阅读:
    这样的程序员创业有戏
    一个29岁总裁对大学生的16条忠告
    向C#的String类添加按字节截取字符串的扩展方法
    妙用SQL Server聚合函数和子查询迭代求和
    为什么要在定义抽象类时使用abstract关键字
    C# 抽象类
    C# 虚函数和重载函数
    在指定文本里记录内容
    静态和非静态方法
    抽象类
  • 原文地址:https://www.cnblogs.com/haozong/p/11236928.html
Copyright © 2011-2022 走看看