Sep-30-2019, 07:19 AM
I know this. This is s****
You have to use
You have to use
os.path.relpath
.Type 'copyright', 'credits' or 'license' for more information IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: import os In [2]: os.path.relpath('/home/andre/test', '/etc/systemd/system/') Out[2]: '../../../home/andre/test' In [3]: In [3]: os.path.relpath('/etc/systemd/system/', '/home/andre/test') Out[3]: '../../../etc/systemd/system' In [4]: os.path.relpath? Signature: os.path.relpath(path, start=None) Docstring: Return a relative version of a path File: ~/.pyenv/versions/3.7.4/lib/python3.7/posixpath.py Type: function In [5]:
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!