SyntaxFix
Write A Post
Hire A Developer
Questions
Another way would be adding __getitem__, __setitem__ function
def __getitem__(self, key): return getattr(self, key)
You can use self[key] to access now.