How to access dictionary keys like attributes in Python

Accessing dictionary keys like attributes allows the syntax dictionary.key to return the value in dictionary associated with key.

Solution for How to access dictionary keys like attributes in Python : You can use super() to access dictionary keys like attributes Create a class which inherits from dict. Wthin the __init__ method of the class, use super(AttrDict, self).__init__(*args, **kwargs) to allow keys to be accessed like attributes.


how-to-access-dictionary-keys-like-attributes-in-python