Skip to content

Instantly share code, notes, and snippets.

@kevinw
Created January 20, 2011 18:22
Show Gist options
  • Save kevinw/788316 to your computer and use it in GitHub Desktop.
Save kevinw/788316 to your computer and use it in GitHub Desktop.
# -----------------------------------------------------------------------------
# f i l e B a s e O f ( ) -- Return base name of filename --
# ^^^^^^^^^^^^^^^^^^^^^^^
#
def fileBaseOf(filename,withPath=0) :
pos = filename.rfind('.')
if pos > 0:
filename = filename[:pos]
if withPath:
return filename
else:
return os.path.basename(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment