python get directory last level 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'