2018年3月19日 星期一

Placeholders

>>> sent = "%s is %d years old."
>>> sent%("John",  13)
'John is 13 years old.'

>>> sent
'%s is %d years old.'
>>>


>>>
>>> sent2 = sent%("Ali", 40 )
>>> sent2
'Ali is 40 years old.'
>>>

沒有留言:

張貼留言