Created
June 7, 2017 17:14
-
-
Save mannysz/14d4373df359ee4ee9759c870f8690cf to your computer and use it in GitHub Desktop.
Stripping directory and extension from file name
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 | |
FILENAME = "/path/to/my/filewith.ext" | |
base_name = os.path.basename(FILENAME) | |
without_ext = os.path.splitext(base_name)[0] | |
print(without_ext) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment