get_ext

Contents

get_ext#

get_ext(filename: str | Path) str[source]#

Extract the extension of the filename.

For files with the .gz suffix, the previous extension is returned as well. This is needed for example, for the compressed NIFTI format (.nii.gz).

Parameters:
filenamestr, Path

The filename from which to extract the extension.

Returns:
str

The extracted extension. For files with the .gz suffix, the previous extension is returned as well.