For the following example, is there a way to get the type of a
and b
as int
and string
?
class test(object):
def __init__(self):
self.a = 1
self.b = "abc"
test_obj = test()
for var in vars(test_obj):
print type(var) # this just returns string type as expected (see explanation below)