方法一:
>>>phonebook = {'Beth': '9102', 'Alice': '2431', 'Cecil': '3258'}
>>>"Cecil's phone number is %(Cecil)s." % phonebook
"Cecil's phone number is 3258."
(摘自Python基础教程(第二版))
方法二:
>>> 'There are %(howmany)d %(lang)s Quotation Symbols' % {'lang': 'Python', 'howmany': 3}
'There are 3 Python Quotation Symbols'
(摘自 core python programming)