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
  • 37,241
  • 25
  • 195
  • 267
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
  • 10,365
  • 5
  • 46
  • 73