このスニペット:
formatter = "%r %r %r %r"
print formatter % (
"I had this thing.",
"That you could type up right.",
"But it didn't sing.",
"So I said goodnight."
)
実行すると、次の文字列が出力されます。
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.'
"But it didn't sing."
他の3つの項目が一重引用符で囲まれているのに、なぜ二重引用符で囲まれたのですか?
(このコードは、Learn Python the Hard Way Exercise 8から取得したものです。)