在Python中通过上下文管理器捕获异常
noerr的Python项目详细描述
诺尔
在Python中通过上下文管理器捕捉异常。在
超级简单易用:
fromnoerrimportno_errwithno_err:raiseException("This won't crash my code!")print("Yup, still going with no error!")
也可以记录错误:
^{pr2}$输出:
Exception logged by "LogError"
Traceback (most recent call last):
File "<input>", line 4, in <module>
Exception: Should probably warn the user about this one.
We now see the error, but don't stop because of it
安装
pip install noerr
许可证
版权所有(版权所有)格里菲斯许可证-2020
- 项目
标签: