ID EN
OS Path

relpath

Python 3.11

Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature of path or start. On Windows, ValueError is raised when path and start are on different drives.

Syntax

PYTHON
os.path.relpath(path, start=os.curdir)

See Also

ValueError os.curdir Availability path-like object