get_ext

Contents

get_ext#

get_ext(file_path: str | CloudPath | Path) str[source]#

Deprecated since version 1.30.0: Import it from sertit.path instead of sertit.files

Get file extension from file path.

Warning

Extension is given WITHOUT THE FIRST POINT

Parameters:

file_path (AnyPathStrType) – Absolute or relative file path (the file doesn’t need to exist)

Returns:

File name (without extension)

Return type:

str

Example

>>> file_path = 'D:/path/to/filename.zip'
>>> get_ext(file_path)
'zip'