Python dictionary---one key and multi-value

Pairs of keys and value are specified in a dictionary by using the notation d = {key1 : value1, key2 : value2 }. 

one key and multi-value ab = {key1 : (value1, value2),

                                                 key2 : (value3, value4)}

ab = {'Xiaopeng Yang': (18000001219, '18700000019@139.com')}

ab['Qiping kong']= (1590100007, '000004369@qq.com')
for name, (phone, email) in ab.items():
print 'Contact %s phone number is %d, email address is %s' % (name, phone, email)

Output:

================== RESTART: /Users/zhouxin/Desktop/test.py ==================
Contact Qiping kong phone number is 1590100007, email address is 000004369@qq.com
Contact Xiaopeng Yang phone number is 18000001219, email address is 18700000019@139.com
>>>

原文地址:https://www.cnblogs.com/XinZhou-Annie/p/7098892.html