请使用两种format的方式打印字符串Life is short, you need Python
。
一 template = 'Life is short,you need {}' python = 'Python' result = template.format(python) print(result) 二 template = 'life is short,you need {a}' result = template.format(a='Python') print(result)
法一
template = python = result = template.format(python) (result)
法二
template = result = template.format(=) (result)