The dirname() function can be used to extract the directory name from the path as a string.
To get only the directory name directly above the file, os.path can be used.
See more results on Neeva
Summaries from the best pages on the web
dirname() method in Python is used to get the directory name from the specified path.
Parameter: path : A path-like object representing a file system path.
Return Type: This method returns a string value which represents the directory name from the specified path
Python | os.path.dirname() method - GeeksforGeeks
find current directory(or working directory) using python. Current directory is nothing but the folder from where your script is running. This is not the path ...
Get current directory using Python