📜  忽略警告 python 代码示例

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

代码示例3
import warnings

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

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