I have a bunch of file paths, such as:
path1 = "./base/folder1/subfolder"
path2 = "./base/folder2/"
I am trying to write a function that can give me the relative difference between the paths. Using the paths above:
>>> get_path_difference(path1, path2)
"../../folder2"
>>> get_path_difference(path2, path1)
"../folder1/subfolder"
I've had a look through the os.path
module, since it seems like this should be a common thing, but either I don't know the terminology or it isn't there.