from pathlib import Path
a = Path(r'E:\python_apps\bk-pipline\x52_merge_workspace\time_flush\client\3droom\A - 1.17.0.xml')
b = Path(r'E:\python_apps\bk-pipline\x52_merge_workspace\time_flush')
relative_path = (
a.relative_to(b)
.with_name("A")
.with_suffix(Path("/1.17.0.xml").suffix)
)
print(relative_path)
输出: client\3droom\A.xml