這個問題在這里已經有了答案: 使用 ^ 匹配 Python 正則運算式中的行首 3 個答案 17 小時前關閉。
我在用
df["uncleanedcolumn"].str.remove("(?s)From.*Subject", "", regex = True)
洗掉第一行和第三行,即From xxx to Subject:
但是上面的代碼將洗掉整行 1 到 3。我怎樣才能保留第二行?
From xxx to Subject:
my msg here
From xxx to Subject:
more msg here
uj5u.com熱心網友回復:
這個怎么樣?
df["uncleanedcolumn"] = df["uncleanedcolumn"].str.remove("From.*Subject:", "", regex=True)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/491487.html
