Except extension

 
1
2
3
4
from pathlib import Path

path = "/root/dir/file.csv"
name = Path(path).stem  # 'file'