第二电脑网从python pil jpegpython如何忽略警告(warning) 错误分析来看,对python pil jpegpython如何忽略警告(warning) 错误的结果。
运行一个python文件,一直报warning的错误,很是郁闷,于是想到可以忽略这些错误。
下面来说一下如何忽略这些警告。
python -W ignore yourscript.py
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
fxn()
如果不想使用以上方法,可以直接在python源代码中的开始添加如下代码:import warnings
warnings.filterwarnings("ignore")
这样就可以忽略python报警告性错误啦
更多:python pil jpegpython如何忽略警告(warning) 错误
https://www.002pc.comhttps://www.002pc.com/python/4225.html
你可能感兴趣的python,warning,忽略,警告,错误,如何
No alive nodes found in your cluster
0踩
赏
0 赞