Collections
defaultdict
person = {'name':'xiaobai','age':18}
print ("The value of key 'name' is : ",person['name'])
print ("The value of key 'city' is : ",person['city'])
Out: The value of key 'name' is : xiaobai
Traceback (most recent call last):
File "C:\Users\E560\Desktop\test.py", line 17, in <module>
print ("The value of key 'city' is : ",person['city'])
KeyError: 'city'Counter
Deque
Namedtuple
OrderedDict
Chainmap
Last updated
