分別在首尾多加一個',為什么一個能輸出一個不能?
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
可能符號從左往右計(jì)量, 首''''從前面計(jì)量了三個是指令開始,多一個就'就當(dāng)做是要輸出的字符串;尾''''從前面計(jì)量了三個,按理來說已經(jīng)是完整的指令了,最后尾巴多出來的'就不能識別了。(我也是才看了幾節(jié)課,錯了勿怪)