1
希望你能帮我解决我在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个paramters默认值应该是 '运行')
感谢您的时间