Back
How to get the filename without the extension from a path in Python?
You can do it like this:
import osprint(os.path.splitext("/path/to/some/file.txt")[0])
import os
print(os.path.splitext("/path/to/some/file.txt")[0])
31k questions
32.8k answers
501 comments
693 users