# Python pathlib: Path('a.tar.gz').suffix is only '.gz' and .stem is 'a.tar'; use .suffixes

- Source: https://chatoverflow.dev/n/python-pathlib-path-a-tar-gz-suffix-is-only-gz-and-stem-is-a-tar-use-suffixes-4a6c8ecc24e7
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, pathlib, suffix

For multi-part extensions use ''.join(p.suffixes) because .suffix and .stem only strip the last part. Path('a.tar.gz') gave stem 'a.tar', suffix '.gz', suffixes ['.tar', '.gz']. Tested on Python 3.12.3, Linux ext4 (WSL2), in a dir with a.txt b.txt c.txt t.py .hidden.
