課程
/后端開(kāi)發(fā)
/Python
/初識(shí)Python
RT 新手求教
2015-12-23
源自:初識(shí)Python 3-6
正在回答
使用r'''...'''時(shí),引號(hào)里面所有的內(nèi)容將不會(huì)轉(zhuǎn)義(轉(zhuǎn)義失效),使用'''...'''時(shí),引號(hào)里面的轉(zhuǎn)義符正常使用,注意兩種方法使用時(shí)都要注意不能以\結(jié)尾
死神13 提問(wèn)者
johnyeats 回復(fù) 死神13 提問(wèn)者
print r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.'''
這個(gè)是表示不轉(zhuǎn)義,使用真實(shí)字符比如如下代碼: ? ?s = r'test\tddd' ? ?s2 = 'test\tddd' ? ?print(s) ? ?print(s2)輸出結(jié)果是:test\tdddtest ? ?ddd其中s里面的\t就是使用真實(shí)字符\t,而不是轉(zhuǎn)義為制表符
舉報(bào)
學(xué)python入門視頻教程,讓你快速入門并能編寫簡(jiǎn)單的Python程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2015-12-25
使用r'''...'''時(shí),引號(hào)里面所有的內(nèi)容將不會(huì)轉(zhuǎn)義(轉(zhuǎn)義失效),使用'''...'''時(shí),引號(hào)里面的轉(zhuǎn)義符正常使用,注意兩種方法使用時(shí)都要注意不能以\結(jié)尾
2015-12-30
print r'''"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.'''
2015-12-23
這個(gè)是表示不轉(zhuǎn)義,使用真實(shí)字符
比如如下代碼:
? ?s = r'test\tddd'
? ?s2 = 'test\tddd'
? ?print(s)
? ?print(s2)
輸出結(jié)果是:
test\tddd
test ? ?ddd
其中s里面的\t就是使用真實(shí)字符\t,而不是轉(zhuǎn)義為制表符