python dict dot notation

Do you want to know the details regarding “python dict dot notation”. If yes, you’re in the correct tutorial.

python dict dot notation

>>> from types import SimpleNamespace
>>> d = 'key1': 'value1', 'key2': 'value2'
>>> n = SimpleNamespace(**d)
>>> print(n)
namespace(key1='value1', key2='value2')
>>> n.key2
'value2'
>>> from types import SimpleNamespace
>>> d = 'key1': 'value1', 'key2': 'value2'
>>> n = SimpleNamespace(**d)
>>> print(n)
namespace(key1='value1', key2='value2')
>>> n.key2
'value2'

Conclusion

I hope this tutorial helps you to know about “python dict dot notation”. If you have any questions regarding this article please let us know via the comment section. Share this post with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment