replacement field

A pair of braces {} in a format string marking where a value will be inserted.

In more detail

Empty braces are filled in order; {0} or {name} choose a specific argument, so a value can be reused or reordered. After a colon comes a format specifier, as in {:.2f}. To print a literal brace, double it.

Example

"{0} {1} {0}".format("a", "b")

Related terms

Taught in

References