要找到详细说明所有 python 异常的好引用文档似乎并不容易。
例如,每当我遇到 IOError 异常时,它都有不同的消息格式,但我找不到任何好的引用:
IOError: ('http protocol error', 0, 'got a bad status line', None)
或
IOError: [Errno socket error] [Errno 110] Connection timed out
最佳答案
内置异常是 documented , 这里是 IOException .检查errno
符号定义的文档,errno.errorcode
是一个包含错误代码/符号之间映射的字典。
import errno
errno.errorcode[numeric_code]
关于python - 我在哪里可以找到关于 python 异常的好的引用文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6397463/