mirror of https://github.com/flaggo/pydu.git
add path.fileext which return the file extension
This commit is contained in:
parent
ddf87a6f05
commit
a5bbfaf3bd
|
@ -44,3 +44,11 @@ def normjoin(path, *paths):
|
|||
def filename(path):
|
||||
"""Return the filename without extension."""
|
||||
return os.path.splitext(os.path.basename(path))[0]
|
||||
|
||||
|
||||
def fileext(path):
|
||||
"""
|
||||
Return the file extension.
|
||||
If file has not extension, return empty string.
|
||||
"""
|
||||
return os.path.splitext(os.path.basename(path))[1]
|
||||
|
|
Loading…
Reference in New Issue