attribute lookup str and objects like object.myvar
I want to know how i can concat object fields with a variable, it's hard to explain to me, let me give an example Example: My object have: myobject.name = 'Red' myobject.lastname = 'Foo' and I have a function like this: my function .......... some_dumb_field = name print myobject.some_dumb_field And this crashes!, how can i concat the str of the field like an object? I'm guessing you are looking for getattr : print getattr(myobject, some_dumb_field) This will look up the attribute of myobject whose name is given by the string some_dumb_field . For example, getattr(myobject, 'name') is