希望您能帮助我解决下面的问题,我在python中遇到的问题。 我试图使用字符串格式的模板,但需要一些如何有默认值。在
template = """
Server {isServerRunning}
NTP {isNTPrunning}
Application {isAppRunning}
"""
test = template.format(isServerRunning='is not running')
print test
OUTPUT:
Server is not running
NTP is running
Application is running
(假设这3个参数的默认值应该是“正在运行”)
谢谢你的时间
你能把它包含在一个函数中,比如:
相关问题 更多 >
编程相关推荐