# 方法一
template1 = 'Life is {0}, you need {1}'
print(template1.format('short', 'Python'))
# 方法二
template2 = 'Lift is {p1}, you need {p2}'
print(template2.format(p1 = 'short', p2 = 'Python'))
template1 = 'Life is {0}, you need {1}'
print(template1.format('short', 'Python'))
# 方法二
template2 = 'Lift is {p1}, you need {p2}'
print(template2.format(p1 = 'short', p2 = 'Python'))
2025-05-19
h='{0} {1} {2}, {3} {4} {5}'
g=h.format('life','is','short','you','need','Python')
print(g)
g=h.format('life','is','short','you','need','Python')
print(g)
2025-04-21
h='{a} {c}, bsev0w0 {e} {f}'
a1 ='list'
b1 = 'is'
c1 ='short'
d1 = 'you'
e1 = 'need'
f1 = 'Python'
g=h.format(a=a1,b=b1,c=c1,d=d1,e=e1,f=f1)
print(g)
a1 ='list'
b1 = 'is'
c1 ='short'
d1 = 'you'
e1 = 'need'
f1 = 'Python'
g=h.format(a=a1,b=b1,c=c1,d=d1,e=e1,f=f1)
print(g)
2025-04-21