我正在学习 Python the Hard Way 的练习 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.'
为什么第三句用双引号,为什么其他句子用单引号?