为了账号安全,请及时绑定邮箱和手机立即绑定

求大佬解答

template1 = 'Life is {1},'

template2 = 'you need {a}'

k423 = 'python'

print(template1.format('short'),template2.format(a=k423))

这是怎么回事?

http://img1.sycdn.imooc.com//641195510001fba412930634.jpg

正在回答

1 回答

怎么才能使用两个模板,还是说不行?

0 回复 有任何疑惑可以回复我~
#1

枫_筝

template = 'Life is short,{}' A = 'you need Python' result = template.format(A) print(result) template = 'Life is short,{}' result = template.format('you need Python') print(result)
2023-07-26 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Python3 入门教程(新版)
  • 参与学习       147196    人
  • 解答问题       1050    个

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

进入课程

求大佬解答

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信