(字典) Dictionaries

摘要:(字典) Dictionaries

my_information = {'name': 'Pusheen the Cat', 'country': 'USA', 'favorite_numbers': [42, 105]}

del my_information['country'] #刪除

my_information['favorite_color'] = 'citrine white' #新增

print len(my_information)  #顯示數量

for s in my_information:
    print   '{0}:{1}'.format(s,my_information[s])