Answers for "how do i get parent directory python"

2

python get parent directory

from pathlib import Path
Path('C:\Program Files').parent
Posted by: Guest on January-22-2020
4

python get parent directory

import os.path
os.path.dirname('C:\Program Files')
Posted by: Guest on January-22-2020
0

how do i get parent directory python

from pathlib import Path
path = Path(Path.cwd())
print(path.parent)
Posted by: Guest on November-29-2020

Code answers related to "how do i get parent directory python"

Python Answers by Framework

Browse Popular Code Answers by Language