Default Dict

from collections import defaultdict
user = defaultdict(lambda: 'Kevin')
user
defaultdict(<function __main__.<lambda>>, {})
type(user)
collections.defaultdict
user['abc']
'Kevin'
user['country']
'Kevin'
user['name'] = 'Peter'
user['age'] = 21
user['city'] = 'Toronto'
user
defaultdict(<function __main__.<lambda>>,
            {'abc': 'Kevin',
             'age': 21,
             'city': 'Toronto',
             'country': 'Kevin',
             'name': 'Peter'})
for k, v in user.items():
    print(k, "==>", v)
abc ==> Kevin
country ==> Kevin
name ==> Peter
age ==> 21
city ==> Toronto