python 元组

 1 ab={
 2         'Swaroop'   :'swaroopch@bytoofpython.info',
 3         'Larry'     :'larry@wall.org',
 4         'Matsumoto' :'matz@ruby-lang.org',
 5         'Spammer'   :'spammer@hotmail.com'
 6     }
 7 print("Swaroop's address is %s"%ab['Swaroop'])
 8 ab['Guido']='guido@python.org'
 9 del ab['Spammer']
10 print('\nThere are %d contacts in the address-book\n'%len(ab))
11 for name,address in ab.items():
12     print('Contact %s at %s'%(name,address))
13 if 'Guido' in ab:
14     print("\nGuido's address is %s"%ab['Guido'])

 

posted @ 2013-09-17 10:42  yufenghou  阅读(112)  评论(0)    收藏  举报