I know about using print(object, attribute_choice))
to print an attribute but is there a similar possibility to change it? attribute_choice
is enterd by the user.
CodePudding user response:
Use setattr(obj, "myattr", "new_value")
.
I know about using print(object, attribute_choice))
to print an attribute but is there a similar possibility to change it? attribute_choice
is enterd by the user.
CodePudding user response:
Use setattr(obj, "myattr", "new_value")
.