第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

r‘‘‘ ’’’ 與‘‘‘ ’” 有 什么區(qū)別呢

>>> print('''how are you \*_*/

... I'm fine

... and you ?''')

how are you \*_*/

I'm fine

and you ?

>>> print('\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.')

"To be, or not to be": that is the question.

Whether it's nobler in the mind to suffer.

>>> print(''' To be ,or not to be :that is a question.

... Whether it's nobler int her mind to suffer.''')

?To be ,or not to be :that is a question.

Whether it's nobler int her mind to suffer.


正在回答

2 回答

r'''...'''會(huì)對(duì)'''...'''中的內(nèi)容進(jìn)行轉(zhuǎn)義

單獨(dú)的'''...''',就只是一個(gè)換行的作用

http://img1.sycdn.imooc.com//5f8fafde0001948312580512.jpg

0 回復(fù) 有任何疑惑可以回復(fù)我~

>>> print('\"To be, or not to be\": that is the question.\nWhether it\'s nobler in the mind to suffer.')

"To be, or not to be": that is the question.

Whether it's nobler in the mind to suffer.

>>> print(''' To be ,or not to be :that is a question.

... Whether it's nobler int her mind to suffer.''')

?To be ,or not to be :that is a question.

Whether it's nobler int her mind to suffer.

注意這兩個(gè)輸出的內(nèi)容有區(qū)別,第一個(gè)輸出的to be or not to be是帶有雙引號(hào)的,第二個(gè)沒(méi)有。

第一個(gè)print的內(nèi)容因?yàn)榧从须p引號(hào)"To be, or not to be",又有單引號(hào)it's,因?yàn)樵趐rint的時(shí)候需要對(duì)內(nèi)容中的引號(hào)進(jìn)行轉(zhuǎn)義,使用轉(zhuǎn)義符號(hào)\,涉及到換行的時(shí)候使用\n

第二個(gè)print的內(nèi)容是沒(méi)有雙引號(hào),只有單引號(hào)的,這種情況下不需要對(duì)引號(hào)進(jìn)行轉(zhuǎn)義,就可以輸出,只需要使用'''...'''來(lái)進(jìn)行轉(zhuǎn)行。如果第二個(gè)print的內(nèi)容跟第一個(gè)一樣,即有雙引號(hào)又有單引號(hào),那么你只使用'''...'''恐怕打印不出想要的內(nèi)容

由于轉(zhuǎn)義符號(hào)用起來(lái)比較麻煩,我們有一個(gè)相對(duì)簡(jiǎn)單的工具,叫raw字符串,即r'...',它表示對(duì)引號(hào)內(nèi)的內(nèi)容進(jìn)行轉(zhuǎn)義,即告訴計(jì)算機(jī),你甭管引號(hào)里是什么內(nèi)容了,直接依原樣輸出為字符串。當(dāng)然raw字符串也可以搭配'''...'''來(lái)使用,即多增加了一個(gè)轉(zhuǎn)行的效果。r'''...'''的作用是對(duì)引號(hào)內(nèi)的內(nèi)容進(jìn)行轉(zhuǎn)行并轉(zhuǎn)義。

'''...'''的作用只是對(duì)內(nèi)容進(jìn)行轉(zhuǎn)行,如果涉及到需要轉(zhuǎn)義的情況,它是完不成的。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

r‘‘‘ ’’’ 與‘‘‘ ’” 有 什么區(qū)別呢

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)