human
Python: Get relative path from comparing two absolute paths
assistant
Here is some code to get relative path of path '/usr/var' regarding path '/usr/var/log/'

print(os.path.relpath('/usr/var/log/', '/usr/var'))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.