How to get the extension of a filename from the path
gene.tani at gmail.com
Thu Dec 8 13:26:02 CET 2005
> what is a way to get the the extension of a filename from the path?
> E.g., on my XP windows the path can be
> and I would like to get
> the the extension of the filename, that is here
> I would like that to work on Linux also
> Thank you for help
minor footnote: windows paths can be raw strings for os.path.split(),
or you can escape "/"
tho Tom's examp indicates unescaped, non-raw string works with
print "path: %s ;;;;; fname and ext: %s"%(fpath, fname_ext)
More information about the Python-list