format()方法:
>>> stu {'name': 'Jack', 'sex': 'm', 'age': 22} >>> 'his name is {name}, his age is {age}'.format(**stu) 'his name is Jack, his age is 22'
format_map()方法:
>>> 'his name is {name}, his age is {age}'.format_map(stu) 'his name is Jack, his age is 22'