Don't. Attribute access and indexing are separate things in Python, and you shouldn't want them to perform the same. Make a class (possibly one made by namedtuple
) if you have something that should have accessible attributes and use []
notation to get an item from a dict.
↧
Answer by Mike Graham for How to use a dot "." to access members of dictionary?
↧