【发布时间】:2021-06-18 00:00:44
【问题描述】:
我想知道为什么warnings.filterwarnings("ignore") 不能忽略所有警告消息。这里有什么要求吗?
>>> import logging
>>> import warnings
>>> warnings.filterwarnings("ignore")
>>> logging.warn("This should not be printed")
WARNING:root:This should not be printed
>>>
【问题讨论】:
标签: python-3.x logging warnings suppress-warnings