0

I have a dictionary with several items.

d = {}
d['name'] = 'Umair'
d['field'] = 'Programmer'
FunctionHere(name = d['name'], field = d['field'])

How can I pass that dictionary as named parameters without writing each value?

Umair Ayub
  • 15,903
  • 12
  • 65
  • 138

1 Answers1

1

The syntax is:

FunctionHere(**d)

Documented in the section about unpacking arguments here: https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists

wim
  • 302,178
  • 90
  • 548
  • 690