字符串format任务

来源:3-7 Python的字符串format

qq_林林小小_0

2021-05-28 11:14

# 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)


写回答 关注

1回答

  • 子夜十分
    2021-05-31 21:51:36

    Lift is short,you need Python

    Lift is short,you need Python

Python3 入门教程(新版)

python3入门教程,让你快速入门并能编写简单的Python程序

154160 学习 · 1075 问题

查看课程

相似问题