I have a Path
Object representing C:\Users\users\Downloads\img.jpg
. How do I get it so the Path only represents C:\Users\user\Downloads
? I don't want to delete the file, but rather go back in the Path object itself.
from pathlib import Path
path = Path('C:/Users/user/Downloads/img.jpg')
# Want to get path only to C:\Users\user\Downloads