KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to create an object from a dictionary in python in such a way that each key is an attribute of that object? Something like this: d = { 'name': 'Oscar', 'lastName': 'Reyes', 'age':32 } e = Employee(d) print e.name # Oscar print e.age + 10 # 42 I think it would be pretty much the inverse of this question: Python dictionary from an object's fields
Tags (comma-separated)
Save Edits
Cancel