Q:

string formatting / value passing not working for format

Given the following two methods:
def test():
   string = "{test}"
   print convert(string, test='test')

def convert(string, **test):
    return string.format(test)

Why does this throw an KeyError: 'test'?
As I have seen in other threads, this should be a valid way of passing values, shouldn't it?

A:

As shown in the question you linked to, you need to expand the keyword-argument dictionary when passing it to format:
return string.format(**test)

