问答详情
源自:3-6 Python中raw字符串与多行字符串

无法用r'''形式实现'结尾的字符串输出

比如我想输出结果是 '"To be, or not to be": that is the question.Whether it's nobler in the mind to suffer.'

提问者:宝慕林6349968 2026-04-28 15:22

个回答

  • weixin_慕函数0077650
    2026-05-17 17:33:41

    #!/usr/bin/python3
    print('\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.')
    print(r'''"To be, or not to be": that is the question.
    Whether it's nobler in the mind to suffer''')
    不知道你是怎么输入的,可以参考我的代码