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
  • 19,358
  • 14
  • 72
  • 146

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
  • 338,267
  • 99
  • 616
  • 750