python formatter 既有单引号又有双引号

formatter="%r%r%r%r"printformatter%(1,2,3,4,)printformatter%("one","two","three","fou... 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."
)

为什么在最后四句话输出的时候只有第三句有双引号
1 2 3 4
'one' 'two' 'three' 'four'
True False False True
'%r %r %r %r' '%r %r %r %r' '%r %r %r %r' '%r %r %r %r'
'I had this thing.' 'That you could type up right.' "But it didn't sing." 'So I said goodnight.'
展开
 我来答
百度网友4b27e51
2020-05-18
知道答主
回答量:1
采纳率:0%
帮助的人:614
展开全部
这是嵌套关系,因为在But it didn't sing.里面有单引号了,所以外面必须用双引号。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式