什么是使用*的.format(*)?在下面的格式函数中使用它时,print(new_string.format(*sum_string))它会将输出中sum_string的值从18更改为1为什么会发生这种情况?我已阅读以下链接*args,**kwargs但无法理解这是如何适用于该.format()功能
sum_string = "18"
new_string = "This is a new string of value {}"
print(new_string.format(sum_string)) #it provides an output of value 18
print(new_string.format(*sum_string)) #it provides an output of value 1
Run Code Online (Sandbox Code Playgroud)