字符串format任务
# Enter a code
testFormat="Life is {1}, you need {0}"
result1=testFormat.format("Python","short")
print(result1)
testFormat="Life is {s}, you need {p}"
s="short"
p="Python"
result2=testFormat.format(p=p,s=s)
print(result2)
# Enter a code
testFormat="Life is {1}, you need {0}"
result1=testFormat.format("Python","short")
print(result1)
testFormat="Life is {s}, you need {p}"
s="short"
p="Python"
result2=testFormat.format(p=p,s=s)
print(result2)
2021-05-28
举报