How to call a function using apply with keyword args?

Martin v. Löwis loewis at
Thu Jun 13 03:50:32 EDT 2002

"Achim Domma" <achim.domma at> writes:

> I have a function like this:
> def MyFkt(A,B,C): pass
> and some parameters from a config file:
> params = {'A':5,'B':8,'C':9}
> how can I call MyFkt with this parameters? 

I recommend


> I tried apply(MyFkt,[],params) 

If you want to use apply, it is

apply(MyFkt, (), params)

The arguments need to be a tuple.


More information about the Python-list mailing list