[問題] replace multiple string in text file
我想讀取某個txt檔,然後取代裡面的字元。
例如~ I -> You , is -> are
out = open("new.txt", "wt")
for line in open("old.txt")
out.write(line.replace('I', 'You'))
請問我要如何寫才能同時將 I、is 換成 You、are,然後存到new.txt。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.227.107
推
11/15 17:20, , 1F
11/15 17:20, 1F
→
11/15 17:21, , 2F
11/15 17:21, 2F
→
11/15 17:32, , 3F
11/15 17:32, 3F
Python 近期熱門文章
PTT數位生活區 即時熱門文章
14
26