get current path python get parent directory code example
Example 1: python get parent directory
import os.path
os.path.dirname('C:\Program Files')
Example 2: how do i get parent directory python
from pathlib import Path
path = Path(Path.cwd())
print(path.parent)