PyDocs

Nav

Python Runtime Services

str.format_map

builtins

method of str · Added in 3.2
  • str.format_map(mapping, /)
Return a formatted version of the string, using substitutions from mapping.
The substitutions are identified by braces ('{' and '}').
1 Example
>>> class Default(dict):
...     def __missing__(self, key):
...         return key
...
>>> '{name} was born in {country}'.format_map(Default(name='Guido'))
'Guido was born in country'
from the Python docs
See Also
No see-alsos for builtins/str.format_map
0 Notes
No notes for str.format_map