0

i got a given dictionary - for instance: x = {'a': 1,'b': 2, 'c': 3} what i would like to do is sending all keys and values to some function. for instance: func1(a=1,b=2,c=3)

(for other dictionary y = {'z': 8,'x': 9, 'w': 11,'p': 88} the function call will be: func1(z=8,x=9,w=11,p=88))

is it possible?

Thank you.

2 Answers2

2

This is a built in feature of python, consider the following:

x = {'a': 1,'b': 2, 'c': 3}
func1(**x)

is the same as:

func1(a=1, b=2, c=3)

I recommend you read the documentation on defining fuctions

Nullman
  • 4,179
  • 2
  • 14
  • 30