PyDocs

Nav

File and Directory Access

PurePath.suffix

pathlib

attribute of PurePath (source)
The final component's last suffix, if any.

This includes the leading period. For example: '.txt'
Changed in 3.14
  • 3.14: A single dot (”.”) is considered a valid suffix.
1 Example
>>> PurePosixPath('my/library/setup.py').suffix
'.py'
>>> PurePosixPath('my/library.tar.gz').suffix
'.gz'
>>> PurePosixPath('my/library').suffix
''
from the Python docs
See Also
No see-alsos for pathlib/PurePath.suffix
0 Notes
No notes for PurePath.suffix