#! /usr/bin/python # Filename: dict.py # Description: a simple demo to use dict dic = { 'deercoder':'[email protected]', 'Emily': '[email protected]', 'Frank': '[email protected]', 'Stanley': '[email protected]' } print 'Stanley\'s email address is %s' % dic['Stanley'] ### Now add a item dic['kkpattern'] = '[email protected]' for name,address in dic.items(): print 'Contact name is %s, address is %s' %(name, address) del dic['Emily'] for name, address in dic.items(): print 'Contact name is %s, address is %s' %(name, address)