sách gpt4 ăn đã đi

python - cảnh báo.warn() hoặc logging.warning()

In lại Tác giả: IT Lão Cao 更新时间:2023-10-28 20:37:23 29 4
mua khóa gpt4 giày nike

warnings.warn() 和有什么区别?和 logging.warn()就它们的作用和应该如何使用而言?

câu trả lời hay nhất

我同意另一个答案——ghi nhật ký 用于记录,warning 用于警告——但我想添加更多细节。

这里是一个教程式的 HOWTO,带您完成使用 ghi nhật ký 模块的步骤。 https://docs.python.org/3/howto/logging.html

它直接回答了你的问题:

warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning

logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted

关于python - warnings.warn() 与 logging.warning(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9595009/

29 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress