python标准库之ordereddict

from collections import OrderedDict
favorite_languages = OrderedDict()

favorite_languages[‘jen’] = ‘python’
favorite_languages[‘sarah’] = ‘c’
favorite_languages[‘edward’] = ‘ruby’
favorite_languages[‘phil’] = ‘python’

for name ,language in favorite_languages.items():
print(name.title()+"'s favorite language is"+language.title())

你可能感兴趣的:(python标准库之ordereddict)