Need to call functions/class_methods etc using string ref :How

Donn Ingle donn.ingle at gmail.com
Mon Nov 26 15:16:04 EST 2007


> target = <module or any other objet here>
> for funcname in funclist:
> func = getattr(target, funcname, None)
> if callable(func):
> func(*args, **kwargs)
Nice. 'callable' is new to me. Live and learn :)

\d




More information about the Python-list mailing list