我在学习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的问题是为什么报价不同,而不是为什么报价在那里。 –