I know that there are functions for finding the parent directory or path, for example.
os.path.dirname(os.path.realpath(__file__))
'C: \ Users \ JAHON \ Desktop \ Projects \ CAA \ Result \ CAA \ project_folder'
Is there a function that just returns the name of the parent folder? In this case, it should be project_folder .
source share