How do I set a property in python using its string name
- by dave
Hey, here's a dumb question: how can I set an object property given its name in a string. I have a dictionary being passed to me and I wish to transfer its values into namesake properties using code like this:
for entry in src_dict:
if entry.startswith('can_'):
tgt_obj[entry] = src_dict_profile[entry]
I'm still a bit of a noob with Python so would appreciate some help.
- dave.