Quantcast
Channel: How to use a dot "." to access members of dictionary? - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Answer by Dmitry Zotikov for How to use a dot "." to access members of dictionary?

$
0
0

Use SimpleNamespace:

>>> from types import SimpleNamespace   >>> d = dict(x=[1, 2], y=['a', 'b'])>>> ns = SimpleNamespace(**d)>>> ns.x[1, 2]>>> nsnamespace(x=[1, 2], y=['a', 'b'])

Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>