dictionary unpacking

Writing ** before a dictionary in a function call to pass each of its key-value pairs as a keyword argument.

In more detail

template.format(**d) is the same as writing template.format(one=d["one"], two=d["two"]) for every key. The keys must be strings matching the parameter or field names.

Example

"{a}-{b}".format(**{"a": 1, "b": 2})

Related terms

Taught in

References