如何计算两个目录路径之间的相对路径?

2024-04-30 01:23:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有两个目录:

subdir1 = live/events/livepkgr/events/_definst_/
subdir2 = live/streams/livepkgr/streams/_definst_/

结果必须是:

diff_subdir = ../../../../streams/livepkgr/streams/_definst_/

Tags: 目录livediffeventsstreamssubdirdefinstsubdir1