I find it more convenient to access dict keys as obj.foo instead of obj[\'foo\'], so I wrote this snippet:
obj.foo
obj[\'foo\']
class AttributeDict(dict
You can use dict_to_obj https://pypi.org/project/dict-to-obj/ It does exactly what you asked for
From dict_to_obj import DictToObj a = { 'foo': True } b = DictToObj(a) b.foo True