如何在终端中隐藏 python 消息

How to hide python message in terminal

我正在使用 python 模块 IPTCInfo3,每次导出数据时都会在终端中收到此消息。

Marker scan hit start of image data

如何隐藏此消息?我需要清理终端。

如果我参考了源码here, here and here,你可以试试:

logging.getLogger("iptcinfo").setLevel(logging.ERROR)

导入模块后