簡體   English   中英

如何在logging.info中傳遞多個參數

[英]how to pass multiple parameters in logging.info

我在日志記錄中傳遞參數

logging.info("the before and current time are",befot,curt)

但我得到錯誤

--- Logging error ---

TypeError: not all arguments converted during string formatting

您必須像下面這樣格式化日志:

logging.info("之前和當前時間是{}".format(befot)+' {}'.format(curt))

logging.info(f"the before and current time are {befot} {curt}")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM