◐ Shell
reader mode source ↗
Skip to content
Closed
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
19 changes: 17 additions & 2 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,10 @@ Pure paths provide the following methods and properties:

.. method:: PurePath.relative_to(*other)

Compute a version of this path relative to the path represented by
*other*. If it's impossible, ValueError is raised::

>>> p = PurePosixPath('/etc/passwd')
>>> p.relative_to('/')
Expand All @@ -555,6 +557,19 @@ Pure paths provide the following methods and properties:
.format(str(self), str(formatted)))
ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is relative and the other absolute.

NOTE: This function is part of :class:`PurePath` and works with strings. It does not check or access the underlying file structure.


Expand Down
Toggle all file notes Toggle all file annotations