About Dictionary

..... Adding new key-value pair to dictionary
$ menu = {} # Empty dictionary
$ menu['Chicken Alfredo'] = 14.50
$ print menu['Chicken Alfredo']
$ print "There are " + str(len(menu)) + " items on the menu."
   There are 1 items on the menu.

.....Removed from a dictionary

$ del dict_name[key_name]


  

Comments

Popular posts from this blog

AttributeError: Got AttributeError when attempting to get a value for field `abc` on serializer `PfleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'abc'.

ImportError: No module named regex