鱼C论坛

 找回密码
 立即注册
查看: 2118|回复: 3

提问:为什么输出的结果有的是双引号,有的是单引号

[复制链接]
发表于 2017-2-5 08:54:31 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
代码:

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",
    "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' "But it didn't sing." 'So I said goodnight.'


提问:代码和代码运行后的结果如上,请问为什么 输出的结果中("But it didn't sing.")是双引号的?

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-2-5 09:26:28 | 显示全部楼层
"But it didn't sing."
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-2-5 10:32:00 | 显示全部楼层
SixPy 发表于 2017-2-5 09:26
"But it didn't sing."

为什么另外三个是单引号,只有这一个是双引号呢?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-2-5 10:54:07 | 显示全部楼层
x3600891 发表于 2017-2-5 10:32
为什么另外三个是单引号,只有这一个是双引号呢?

"But it didn't sing."
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-29 08:23

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表