get last directory in path python code example
Example: get last element path
>>> os.path.basename(os.path.normpath('/folderA/folderB/folderC/folderD/'))
'folderD'
>>> os.path.basename(os.path.normpath('/folderA/folderB/folderC/folderD/'))
'folderD'