How to get the filename without the extension from a path in Python?
For instance, if I had "/path/to/some/file.txt", I would want "
"/path/to/some/file.txt"
"
On Windows system I used drivername prefix as well, like:
>>> s = 'c:\\temp\\akarmi.txt' >>> print(os.path.splitext(s)[0]) c:\temp\akarmi
So because I do not need drive letter or directory name, I use:
>>> print(os.path.splitext(os.path.basename(s))[0]) akarmi