python basename file code example
Example 1: python os.path.isdir exception
import os
if os.path.isdir(root_folder):
print('Ok')
else:
print('Nok')
Example 2: python get base directory
import os
os.path.dirname(os.path.realpath(__file__))
Example 3: python file basename
#basename with extension
basename = os.path.basename(path)