python class get attribute code example
Example 1: python class get attribute by name
>>> class c:
pass
o = c()
>>> setattr(o, "foo", "bar")
>>> o.foo
'bar'
>>> getattr(o, "foo")
'bar'
Example 2: get object attributes python
for att in dir(your_object):
print (att, getattr(your_object,att))
Example 3: python get attributes of object
field_name = "fullName"
print getattr(user, field_name) # prints content of user.fullName