format的两种方式:相当于变量.format会向变量中的{}中填入字符
1.
template = 'Life is {0}, you need {1}' #0表示带入format中第一个参数表示,1表示第二个位置
template.format('short ', 'python ')
2.不可以把short和python的变量名设置为{ }中的变量名,即 c d改成a b就会报错
template = 'Life is {a},you need {b}'
c='short'
d='python'
result = template.format(a=c,b=d)
print(result)