我不明白这个str.format_map(mapping)方法.我只知道它与str.format(*args, **kwargs)方法类似,你也可以传递字典作为参数(请参阅我的例子).例:
print ("Test: argument1={arg1} and argument2={arg2}".format_map({'arg1':"Hello",'arg2':123}))
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释str.format_map(mapping)和str.format(*args, **kwargs)方法之间的区别,为什么我需要这个str.format_map(mapping) 方法?