如题
2 回答
神不在的星期二
TA贡献1963条经验 获得超6个赞
import os
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(".txt"):
path = os.path.join(root, file)
with open(path, "r") as f:
content = f.read().replace("aaa", "bbb")
with open(path, "w") as f:
f.write(content)
- 2 回答
- 0 关注
- 220 浏览
添加回答
举报
0/150
提交
取消