pathlib get parent directory code example
Example 1: pathlib path get directory of current file
import pathlib
pathlib.Path(__file__).parent.absolute()
Example 2: python get parent directory
import os.path
os.path.dirname('C:\Program Files')
Example 3: python get parent directory
from pathlib import Path
Path('C:\Program Files').parent