in bash script or linux terminal

%%bash

basename /home/abanoub/Work/hello.py .py

hello

in Python 3

%%pyhton3

from pathlib import Path

p = Path('/home/abanoub/Work/hello.py')

print(p.stem)

If you want to get new posts, read the new up-to-date blog posts and tutorials here.