How to convert a nested Python dict to object?
Update: In Python 2.6 and onwards, consider whether the namedtuple data structure suits your needs: >>> from collections import namedtuple >>> MyStruct = namedtuple(‘MyStruct’, ‘a b d’) >>> s = MyStruct(a=1, b={‘c’: 2}, d=[‘hi’]) >>> s MyStruct(a=1, b={‘c’: 2}, d=[‘hi’]) >>> s.a 1 >>> s.b {‘c’: 2} >>> s.c Traceback (most recent call last): File … Read more