📜  警告忽略python代码示例

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

代码示例3
import warnings

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

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