- 用法:- str.format_map(mapping)
- 类似于 - str.format(**mapping),除了直接使用- mapping而不是复制到- dict。如果例如- mapping是一个 dict 子类,这很有用:- >>> class Default(dict): ... def __missing__(self, key): ... return key ... >>> '{name} was born in {country}'.format_map(Default(name='Guido')) 'Guido was born in country'- 3.2 版中的新函数。 
相关用法
- Python str.isidentifier用法及代码示例
- Python str.expandtabs用法及代码示例
- Python str.isupper用法及代码示例
- Python str.title用法及代码示例
- Python str.rstrip用法及代码示例
- Python str.splitlines用法及代码示例
- Python str.lstrip用法及代码示例
- Python str.removeprefix用法及代码示例
- Python str.split用法及代码示例
- Python str.zfill用法及代码示例
- Python str.strip用法及代码示例
- Python str.removesuffix用法及代码示例
- Python str() vs repr()用法及代码示例
- Python string转integer用法及代码示例
- Python string strip()用法及代码示例
- Python string.octdigits用法及代码示例
- Python string.whitespace用法及代码示例
- Python strip()用法及代码示例
- Python str()用法及代码示例
- Python string capitalize()用法及代码示例
注:本文由纯净天空筛选整理自python.org大神的英文原创作品 str.format_map。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
