Python File Parent

from pathlib import Path
path = Path("/here/your/path/file.txt")
print(path.parent.absolute())
Annoyed Alligator