get a path of a directory python code example
Example 1: get path to current directory python
import os
os.path.abspath(os.getcwd())
Example 2: python get path of file
>>> import os
>>> filepath="/media/rtsuse/some/random/filepath/with/logfile.log"
>>> os.path.dirname(filepath)
'/media/rtsuse/some/random/filepath/with'