Keyword Arguments

Ryan ryanscott at trentu.ca
Fri Nov 14 22:41:59 CET 2003


How can I use the value of a variable to represent a keyword in a function call?

For example:

def foo(**kwargs):
    kwargs = **kwargs


item = "temperature"

foo(item=25.5)

I would like the keyword to be the value of item which is temperature.
Is this possible?

Thanks
Ryan




More information about the Python-list mailing list