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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

python從包含特定表達(dá)式的字符串中刪除特定行

python從包含特定表達(dá)式的字符串中刪除特定行

有只小跳蛙 2023-04-25 17:42:38
我有以下字符串/文本streets_and_names = '''#street 49 description someone lives there name Paul#street 51 description no one lives there name no name#street 43 description someone lives there name Mark#street 42 description no one lives there name no name#'''我想通過從中刪除以下行來獲得輸出 description no one lives there name no name其余的保持原樣。有人知道嗎?謝謝。
查看完整描述

1 回答

?
LEATH

TA貢獻(xiàn)1936條經(jīng)驗 獲得超7個贊

如果您的示例是字面的并且只是執(zhí)行了res = streets_and_names.replace(' description no one lives there\n name no name', ''),您將得到您想要的結(jié)果。


結(jié)果:


'''

#

street 49

 description someone lives there

 name Paul

#

street 51

#

street 43

 description someone lives there

 name Mark

#

street 42

#

'''


查看完整回答
反對 回復(fù) 2023-04-25
  • 1 回答
  • 0 關(guān)注
  • 136 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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