In Python 3.4+ you can use the pathlib
solution
from pathlib import Path
print(Path(your_path).resolve().stem)
In Python 3.4+ you can use the pathlib
solution
from pathlib import Path
print(Path(your_path).resolve().stem)