是否可以抑制python中的信息记录输出?

发布于 2025-02-10 08:31:45 字数 501 浏览 2 评论 0 原文

我想抑制特定的信息输出:

INFO     Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.

我知道可以抑制警告,请参阅,但似乎不适用。这个问题是一般的,不应取决于上下文,在这种情况下, matplotlib 混乱了 并可以使用另一种方式避免它。

I would like to suppress specific INFO output:

INFO     Using categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.

I know that warnings can be suppressed, see warnings — Warning control, but it does not seem to be applicable. The question is general and should not depend on the context, in that case messing up with matplotlib
and can avoid it by using another way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤蝉 2025-02-17 08:31:45

我遇到了同样的问题。我以自己的方式使用了登录,并出于开发原因将其设置为调试。

我还使用了matplotlib,这只是我的调试级别的定义,我开始看到很多不是我的调试消息。

我最好的猜测是导入日志记录和设置日志级别高于信息。

I've had the same issue. I used logging in my own terms and set it to DEBUG for development reasons.

I also used matplotlib and it just took my debug level definition and I started to see a whole lot of debug messages which were not mine.

My best guess would be to import logging and setting the log level higher than info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文