Python string format_map() function returns a formatted version of the string using substitutions from the mapping provided. The substitution arguments are present in the string and identified by curly braces ({ }).
Python字符串format_map()函数使用提供的映射中的替换返回字符串的格式化版本。 替换参数出现在字符串中,并用花括号({})标识。
Python字符串format_map() (Python String format_map())
This function was introduced in Python 3.2. It’s syntax is:
此功能在Python 3.2中引入。 它的语法是:
str.format_map(mapping)
Let’s look at some examples of format_map() function.
我们来看一下format_map()函数的一些示例。
s = 'My name is {name} and I am a {job_title}'
my