当从tldextract中导入extract模块时,在控制台上会出现以下日志错误。如何在Python中处理此类日志记录并避免在控制台上可见。
找不到记录器“tldextract”的处理程序
from tldextract import extract
url = "https://sub.example.com/hello.html"
tsd, td, ts = extract(url)
print(td)
当从tldextract中导入extract模块时,在控制台上会出现以下日志错误。如何在Python中处理此类日志记录并避免在控制台上可见。
找不到记录器“tldextract”的处理程序
from tldextract import extract
url = "https://sub.example.com/hello.html"
tsd, td, ts = extract(url)
print(td)
add this:
from tldextract.tldextract import LOG
import logging
#disable tldextract stderr spam
logging.basicConfig(level=logging.WARN)
LOG.debug('spam spam spam')
tldextract
?看起来它可能没有正确设置日志记录。 - glibdudtldextract
版本是多少?我使用的版本是 2.2.0,没有这个问题。使用pip freeze | grep tldextract
命令可以查看版本信息。 - azalea