New submission from Hadi Alqattan <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue41934>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com