class A:
def f1(a,b):
return a+b
def f2(a,b):
return a*b
def f3(a,b):
return a-b
obj = A()
string = 'f1'
I need to access method f1 using the string. Something like :
obj.string(a,b)
How can I achieve this ??
getattr(obj, ' f1 ') does not send any parameters a,b to the funct.
Converting string into an object, is not helping. I even tried function mapping, but that too caused errors.