最贊回答 / 白小九
hello 對應 {0},short 對應 {1},python 對應 {2}。hello 對應 {0},short 對應 {1}, python 對應 {2}你 temp3 里沒有 {0},自然就不會打印 hello,建議改成:<...code...>
2020-09-14
已采納回答 / qq_慕少3205394
template='Life?is?short,you?need?{P}' P='python' result=template.format(P=P) print(result)P相當于占位符,沒有給他賦值
2020-09-08