🔵 🔵 🔵


Primary

၊၊||၊|။

PurePath.is_relative_to() ⚬|Documentation|1st|20260208171558-00-⌔

pathlib — Object-oriented filesystem paths — Python 3.14.3 documentation#pathlib.PurePath.is_relative_to

PurePath.is_relative_to(other)

Return whether or not this path is relative to the other path.

>>> p = PurePath('/etc/passwd')
>>> p.is_relative_to('/etc')
True
>>> p.is_relative_to('/usr')
False

This method is string-based; it neither accesses the filesystem nor treats “..” segments specially. The following code is equivalent:

>>> u = PurePath('/usr')
>>> u == p or u in p.parents
False

Added in version 3.9.

Deprecated since version 3.12, removed in version 3.14: Passing additional arguments is deprecated; if supplied, they are joined with other.

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •