PyDocs

Nav

File and Directory Access

PurePath.parents

pathlib

attribute of PurePath (source)
A sequence of this path's logical parents.
Changed in 3.10
  • 3.10: The parents sequence now supports slices and negative index values.
1 Example
>>> p = PureWindowsPath('c:/foo/bar/setup.py')
>>> p.parents[0]
PureWindowsPath('c:/foo/bar')
>>> p.parents[1]
PureWindowsPath('c:/foo')
>>> p.parents[2]
PureWindowsPath('c:/')
from the Python docs
See Also
No see-alsos for pathlib/PurePath.parents
0 Notes
No notes for PurePath.parents