from pathlib import Path
Path(Path.cwd()).parent
from pathlib import Path
Path('C:Program Files').parent
import os.path
os.path.dirname('C:Program Files')
from pathlib import Path
path = Path(Path.cwd())
print(path.parent)
In [4]: from os.path import dirname
In [5]: dirname('/home/kristina/desire-directory/scripts/script.py')
Out[5]: '/home/kristina/desire-directory/scripts'
In [6]: dirname(dirname('/home/kristina/desire-directory/scripts/script.py'))
Out[6]: '/home/kristina/desire-directory'