我在學習Python困難方式的exercise 8,我不明白爲什麼print
函數中的某些行用單引號或雙引號打印。在雙引號和單引號中打印
程序如下:
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.'
爲什麼在雙引號中的第三句,爲什麼是單引號其他人呢?
OP的問題是爲什麼報價不同,而不是爲什麼報價在那裏。 –