how to check the value of an attribute in python code example Example: python get object attribute by string x = getattr(t, 'attr1') setattr(t, 'attr1', 21)