[issue41934] Add `has` method to `pathlib.Path` class.
Hadi Alqattan
report at bugs.python.org
Sun Oct 4 16:55:49 EDT 2020
New submission from Hadi Alqattan <alqattanhadizaki at gmail.com>:
Adding a new method to `pathlib.Path` class, `has` method is a method that can determine if the `Path` object has a specific file/dir or not.
Assume that we have a `Path` object for this `project/` directory:
```
project/
main.py
__init__.py
utils/
```
and we want to know if the project directory has `main.py` or not, after adding this method we will be able to do this:
```
from pathlib import Path
project_path = Path("./project")
if project_path.has("main.py"):
pass # do something.
```
----------
components: Library (Lib)
messages: 377973
nosy: hadialqattan
priority: normal
severity: normal
status: open
title: Add `has` method to `pathlib.Path` class.
type: enhancement
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41934>
_______________________________________
More information about the Python-bugs-list
mailing list