📜  python 警告作为错误 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:08.282000             🧑  作者: Mango

代码示例3
import warnings

def fxn():
    warnings.warn("deprecated", DeprecationWarning)

with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    fxn()