get the folder name from the file path string in python code example
Example 1: python get filename from path
import os
print(os.path.basename(your_path))
Example 2: python how to get the folder name of a file
# Basic syntax:
import os
os.path.dirname('/path/to/your/favorite/file.txt')
--> '/path/to/your/favorite/'