How to use dot notation for dict in python?
This functionality already exists in the standard libraries, so I recommend you just use their class. >>> from types import SimpleNamespace >>> d = {‘key1’: ‘value1’, ‘key2’: ‘value2′} >>> n = SimpleNamespace(**d) >>> print(n) namespace(key1=’value1′, key2=’value2’) >>> n.key2 ‘value2’ Adding, modifying and removing values is achieved with regular attribute access, i.e. you can use statements … Read more