没有找到与"tldextract"相对应的处理程序

3

当从tldextract中导入extract模块时,在控制台上会出现以下日志错误。如何在Python中处理此类日志记录并避免在控制台上可见。

找不到记录器“tldextract”的处理程序

from tldextract import extract

url = "https://sub.example.com/hello.html"
tsd, td, ts = extract(url)
print(td)

1
请问您能否添加您的代码?这样我们更容易理解并且有可能首先回答这篇帖子。 - Filnor
什么是tldextract?看起来它可能没有正确设置日志记录。 - glibdud
你的 tldextract 版本是多少?我使用的版本是 2.2.0,没有这个问题。使用 pip freeze | grep tldextract 命令可以查看版本信息。 - azalea
@azalea 我也在使用tldextract==2.2.0。 - D09r
1个回答

1

add this:

from tldextract.tldextract import LOG
import logging
#disable tldextract stderr spam
logging.basicConfig(level=logging.WARN)
LOG.debug('spam spam spam')

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接