import os fil=os.path.abspath("report.md") drkt=os.path.dirname(fil) print(os.path.basename(drkt))