path module get filename code example
Example 1: python get filename from path
import os
print(os.path.basename(your_path))
Example 2: what does filename = path(file).stem python
from pathlib import Path
Path('/root/dir/sub/file.ext').stem
# returns 'file'