iterate over a object in python code example
Example 1: loop through python object
for attr, value in k.__dict__.items():
print(attr, value)
Example 2: iterate through objects with python
class C:
a = 5
b = [1,2,3]
def foobar():
b = "hi"
for attr, value in C.__dict__.iteritems():
print "Attribute: " + str(attr or "")
print "Value: " + str(value or "")