python-学习-打印

来源:互联网 发布:2016淘宝双十一抢红包 编辑:程序博客网 时间:2024/06/05 08:03

单引号和双引号:


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.'

红色部分由于含有单引号,所以最外面的自动变成双引号

0 0
原创粉丝点击