scifirocket
scifirocket

Reputation: 1051

Google Model Attribute get by name

Can I get a google model attribute by passing a string to some function?

To illustrate:
If I were to do .properties().keys(), it would return all the attributes as a list of strings.
If 'Person' is a model and 'age' is an attribute of person, I would like to do something like this:

Person.properties()['age'] = 25

where I set the person's age to 25

Upvotes: 1

Views: 85

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101139

Use Python's setattr:

setattr(a_person, 'age', 25)

Upvotes: 1

Related Questions