Is there a way to use methods within a loop in Python? Something like the following:
obj=SomePythonObject()
list_of_methods=dir(obj)
for i in list_of_methods:
try:
print obj.i()
except:
print i,'failed'
Is there a way to use methods within a loop in Python? Something like the following:
obj=SomePythonObject()
list_of_methods=dir(obj)
for i in list_of_methods:
try:
print obj.i()
except:
print i,'failed'