Open gilbh opened 1 year ago
yes, it should be possible with from_dict
method, give it a try:
>>> from dotdict import DotDict
>>> nested = {"A": {"B": {"C": {"D": 1}}}}
>>> abcd = DotDict.from_dict(nested)
>>> abcd.A
DotDict(B=DotDict(C=DotDict(D=1)))
>>> abcd.A.B
DotDict(C=DotDict(D=1))
>>> abcd.A.B.C
DotDict(D=1)
>>> abcd.A.B.C.D
1
I tried doing this:
Would it be possible to pass the dict already in the class creation?