Quantcast
Viewing latest article 17
Browse Latest Browse All 40

Answer by Pradip Gupta for How to use a dot "." to access members of dictionary?

I recently came across the 'Box' library which does the same thing.

Installation command : pip install python-box

Example:

from box import Boxmydict = {"key1":{"v1":0.375,"v2":0.625},"key2":0.125,          }mydict = Box(mydict)print(mydict.key1.v1)

I found it to be more effective than other existing libraries like dotmap, which generate python recursion error when you have large nested dicts.

link to library and details: https://pypi.org/project/python-box/


Viewing latest article 17
Browse Latest Browse All 40

Trending Articles