jazzband / jazzband/pathlib2

`/ ".."` to go back one step

Open
#87 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
86
Forks
30
PR merge metrics
No merged PRs in 30d

Description

It would be good if there was a feature to make a Path to go back one step by `new_path = some_path / ".."`.
Something like this:
```
from pathlib2 import Path
base_directory = Path("base_directory/source_directory")
data_directory = base_directory / "text_files/text_data"
print(data_directory)
```
That make this output:
```
base_directory/source_directory/text_files/text_data
```
Now with the code below:
```
file_directory = data_directory / ".."
print(file_directory)
```
Output this:
```
base_directory/source_directory/text_files/
```
Instead this:
```
base_directory/source_directory/text_files/text_data/..
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.