欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python 常见的错误类型和继承关系

程序员文章站 2022-05-27 19:42:59
Python所有的错误都是从BaseException类派生 ......

python所有的错误都是从baseexception类派生

baseexception
 +-- systemexit
 +-- keyboardinterrupt
 +-- generatorexit
 +-- exception
      +-- stopiteration
      +-- stopasynciteration
      +-- arithmeticerror
      |    +-- floatingpointerror
      |    +-- overflowerror
      |    +-- zerodivisionerror
      +-- assertionerror
      +-- attributeerror
      +-- buffererror
      +-- eoferror
      +-- importerror
      |    +-- modulenotfounderror
      +-- 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
      |    +-- recursionerror
      +-- syntaxerror
      |    +-- indentationerror
      |         +-- taberror
      +-- systemerror
      +-- typeerror
      +-- valueerror
      |    +-- unicodeerror
      |         +-- unicodedecodeerror
      |         +-- unicodeencodeerror
      |         +-- unicodetranslateerror
      +-- warning
           +-- deprecationwarning
           +-- pendingdeprecationwarning
           +-- runtimewarning
           +-- syntaxwarning
           +-- userwarning
           +-- futurewarning
           +-- importwarning
           +-- unicodewarning
           +-- byteswarning
           +-- resourcewarning