Created
November 9, 2011 22:24
-
-
Save mylons/1353320 to your computer and use it in GitHub Desktop.
super split!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def super_split(absolute_path): | |
fdir, fname = os.path.split(absolute_path) | |
tokens = fname.split('.') | |
ext = tokens[-1] | |
fname_no_ext = '.'.join( [ x for x in tokens[:len(tokens)-1] ]) | |
return fdir, fname_no_ext, ext |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(returning the favor)
check out
os.path.splitext
or