我有一个文件,我想更改文件中的特定字符串。这就是我正在尝试的
import re with open ('input.txt', 'rw' ) as f: content = f.read() content_new = re.sub('destination', r'TEST', content, flags = re.M)
但这实际上并没有做任何事情或更新文件。即我没有看到destination
更新到 TEST
. 有人可以帮助我并告诉我我做错了什么吗?
是不是我没有写入文件?或者 ??
慕妹3242003
相关分类