python - How to find the relative path between two directories? -
i find relative path between 2 directories on system.
example:
if have patha == <patha>
, pathb == <patha>/dir1/dir2
, relative path between them dir1/dir2
.
how find in python? there tool use?
if pathb contained in patha, pathb.replace(patha, '')
relative path, if pathb isn't contained in patha?
os.path.relpath(path1, path2) # that's it
Comments
Post a Comment