>>> from pathlib import Path >>> filename = Path('/some/path/somefile.txt') >>> filename_wo_ext = filename.with_suffix('') >>> print(filename) /some/path/somefile.txt >>> print(filename_wo_ext) /some/path/somefile