我正在一本 python 书中进行练习,我对这段代码中发生的事情感到有些困惑。
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
print formatter % ("one", "two", "three", "four")
print formatter % (True, False, False, True)
print formatter % (formatter, formatter, formatter, formatter)
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
作者没有解释每次“打印”后“格式化程序”在做什么。如果我删除它们,所有打印出来的内容都完全相同。我在这里错过了什么吗?