Skip to content

Instantly share code, notes, and snippets.

@natereed
Created December 17, 2015 01:14
Show Gist options
  • Save natereed/3acbe41475503fdd6e36 to your computer and use it in GitHub Desktop.
Save natereed/3acbe41475503fdd6e36 to your computer and use it in GitHub Desktop.
Split a filename into name and extension
import os
basename = os.path.basename(path)
(root, extension) = os.path.splitext(basename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment