[split-upload 3/6] f2fd4fa backup via proxy
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import os, io
|
||||
|
||||
base = r"D:\资料\03-项目开发\wecom_it_smart_desk\docs"
|
||||
files = [
|
||||
os.path.join(base, "01-产品文档/04-坐席工作台/PRD-REQ-坐席-007-排查模板系统-v1.0.md"),
|
||||
os.path.join(base, "01-产品文档/04-坐席工作台/原型-REQ-坐席-007-排查模板系统-v1.0.html"),
|
||||
os.path.join(base, "02-技术文档/技术架构/技术方案-REQ-坐席-007-排查模板系统-v1.0.md"),
|
||||
os.path.join(base, "03-测试文档/03-功能测试用例/TC-坐席-007-排查模板系统.md"),
|
||||
]
|
||||
|
||||
# 有序替换:先长串后短串,避免 排查模板系统 被 排查模板 误伤
|
||||
content_repls = [
|
||||
("排查模板系统", "分诊排查系统"),
|
||||
("排查模板管理", "分诊排查管理"),
|
||||
("分诊模板", "分诊"),
|
||||
("排查模板", "排查"),
|
||||
]
|
||||
|
||||
for f in files:
|
||||
with io.open(f, "r", encoding="utf-8") as fh:
|
||||
txt = fh.read()
|
||||
counts = []
|
||||
for old, new in content_repls:
|
||||
c = txt.count(old)
|
||||
if c:
|
||||
txt = txt.replace(old, new)
|
||||
counts.append(f"{old}->{new}:{c}")
|
||||
with io.open(f, "w", encoding="utf-8") as fh:
|
||||
fh.write(txt)
|
||||
newname = f.replace("排查模板", "分诊排查")
|
||||
renamed = " (renamed)" if newname != f else ""
|
||||
if newname != f:
|
||||
os.rename(f, newname)
|
||||
print(os.path.basename(newname), "|", "; ".join(counts), renamed)
|
||||
Reference in New Issue
Block a user