file_ext

file_ext(path)

Get the extension of a file

Parameters

Name Type Description Default
path Union[str, List[str]] Path to the file or a list of paths to files required

Returns

Name Type Description
Union[str, List[str]] the extension of a file or a list of extension of the files in case path is a list

Examples

>>> from rlike import *
>>> x = file_ext('mydata.pickle')
>>> x
'.pickle'
>>> x = file_ext(['/home/xyz/mydata.pickle', '/home/xyz/mydata.txt'])
>>> x
['.pickle', '.txt']