目录
11种 Python警告情况
1、exception Warning
2、exception UserWarning
3、exception DeprecationWarning
4、exception PendingDeprecationWarning
5、exception SyntaxWarning
6、exception RuntimeWarning
7、exception FutureWarning
8、exception ImportWarning
9、exception UnicodeWarning
10、exception BytesWarning
11、exception ResourceWarning
17种Python异常情况
11种 Python警告情况
下列异常被用作警告类别;
1、exception Warning
警告类别的基类。
2、exception UserWarning
用户代码所产生警告的基类。
3、exception DeprecationWarning
如果所发出的警告是针对其他 Python 开发者的,则以此作为与已弃用特性相关警告的基类。
会被默认警告过滤器忽略,在 __main__ 模块中的情况除外。
4、exception PendingDeprecationWarning
对于已过时并预计在未来弃用,但目前尚未弃用的特性相关警告的基类。
这个类很少被使用,因为针对未来可能的弃用发出警告的做法并不常见,而针对当前已有的弃用则推荐使用 DeprecationWarning。
5、exception SyntaxWarning
与模糊的语法相关的警告的基类。
6、exception RuntimeWarning
与模糊的运行时行为相关的警告的基类。
7、exception FutureWarning
如果所发出的警告是针对以 Python 所编写应用的最终用户的,则以此作为与已弃用特性相关警告的基类。
8、exception ImportWarning
与在模块导入中可能的错误相关的警告的基类。
9、exception UnicodeWarning
与 Unicode 相关的警告的基类。
10、exception BytesWarning
与 bytes 和 bytearray 相关的警告的基类。
11、exception ResourceWarning
资源使用相关警告的基类。
