分別在首尾多加一個',為什么一個能輸出一個不能?
print(r'''\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.'''')
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.\nWhether it\'s nobler in the mind to suffer.'''')
print(''''\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.''')
2020-09-25
舉報
2020-09-26
可能符號從左往右計量, 首''''從前面計量了三個是指令開始,多一個就'就當做是要輸出的字符串;尾''''從前面計量了三個,按理來說已經是完整的指令了,最后尾巴多出來的'就不能識別了。(我也是才看了幾節課,錯了勿怪)