First, you're printing the
format
method, not calling it. When you do call it, it takes multiple arguments, in the same order as the placeholders, e.g.>>> "{} {} {}".format("foo", "bar", "baz") 'foo bar baz' >>>Also,
key
will be assigned the values of the keys in the dict, so the expression key["name"]
doesn't make any sense.