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

来源:3-6 Python中raw字符串与多行字符串

宝慕林6349968

2026-04-28 15:22

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

写回答 关注

1回答

  • 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''')
    不知道你是怎么输入的,可以参考我的代码


Python3 入门教程

python3入门教程,让你快速入门并能编写简单的Python程序

168048 学习 · 1151 问题

查看课程

相似问题