0

I want to build a query for sunburnt(solr interface) using class inheritance and therefore adding key - value pairs together. The sunburnt interface takes keyword arguments. How can I transform a dict ({'type':'Event'}) into keyword arguments (type='Event')?

Cœur
  • 34,719
  • 24
  • 185
  • 251
chengwei45
  • 13
  • 1

1 Answers1

1

You can do this using dictionary unpacking:

dct = dict({'type':'Event'})

# equivalent to func(type='Event')
func(**dct)
Jonas Adler
  • 9,571
  • 3
  • 41
  • 73