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

為了賬號安全,請及時綁定郵箱和手機立即綁定

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'''...'''會對'''...'''中的內(nèi)容進行轉(zhuǎn)義

單獨的'''...''',就只是一個換行的作用

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.

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

第一個print的內(nèi)容因為即有雙引號"To be, or not to be",又有單引號it's,因為在print的時候需要對內(nèi)容中的引號進行轉(zhuǎn)義,使用轉(zhuǎn)義符號\,涉及到換行的時候使用\n

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

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

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

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

舉報

0/150
提交
取消

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

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

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

幫助反饋 APP下載

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

公眾號

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