简体   繁体   English

如何在logging.info中传递多个参数

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

I passing parameter in logging like我在日志记录中传递参数

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

but i get error但我得到错误

--- Logging error ---

TypeError: not all arguments converted during string formatting

You have to format the log like below:您必须像下面这样格式化日志:

logging.info("the before and current time are {}".format(befot)+' {}'.format(curt)) logging.info("之前和当前时间是{}".format(befot)+' {}'.format(curt))

logging.info(f"the before and current time are {befot} {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