亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

這個多行r,怎么添加換行符呢,除了按鍵盤回車。

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


正在回答

1 回答

加個\n

0 回復 有任何疑惑可以回復我~
#1

高飛的魚 提問者

在Idle輸入: >>> print(r'''"To be, or not to be": that is the question.n\Whether it's nobler in the mind to suffer.''') 結果: "To be, or not to be": that is the question.n\Whether it's nobler in the mind to suffer. 所以我覺得,r字符不支持\n,只支持手動Enter換行。
2022-01-12 回復 有任何疑惑可以回復我~
#2

weixin_慕數據7090326

'''abc'''就是用來括多行字符串的 添加換行符就成了一行,用'abc'
2022-01-12 回復 有任何疑惑可以回復我~
#3

weixin_慕數據7090326 回復 高飛的魚 提問者

對,raw字符串里的\就是\,不表示命令
2022-01-12 回復 有任何疑惑可以回復我~
#4

高飛的魚 提問者 回復 weixin_慕數據7090326

可以把代碼發給我嘛,我這里還是不行。 "To be, or not to be": that is the question.'abc'Whether it's nobler in the mind to suffer.
2022-01-12 回復 有任何疑惑可以回復我~
#5

weixin_慕數據7090326 回復 高飛的魚 提問者

不是這個意思,在r''' '''中就得用回車換行
2022-01-12 回復 有任何疑惑可以回復我~
#6

高飛的魚 提問者 回復 weixin_慕數據7090326

哦哦,明白啦,感謝~
2022-01-12 回復 有任何疑惑可以回復我~
#7

weixin_慕數據7090326 回復 高飛的魚 提問者

你不加r的話可以用\n來換行
2022-01-12 回復 有任何疑惑可以回復我~
查看4條回復

舉報

0/150
提交
取消

這個多行r,怎么添加換行符呢,除了按鍵盤回車。

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號