gpt4 book ai didi

Python 的日志记录模块缺少 "captureWarnings"函数

转载 作者:太空狗 更新时间:2023-10-30 02:13:35 25 4
gpt4 key购买 nike

Python 的标准日志记录模块是 supposed to contain a useful captureWarnings function允许日志记录和 warnings 之间的集成模块。不过,我的安装好像少了这个功能:

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.captureWarnings
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'captureWarnings'
>>> import logging.captureWarnings
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named captureWarnings
>>> import warnings
>>> import logging.captureWarnings
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named captureWarnings
>>>

我做错了什么?

最佳答案

很遗憾,Python 2.6.5's logging module中没有这样的方法。 .你需要 Python 2.7。

关于Python 的日志记录模块缺少 "captureWarnings"函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7627075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com