[issue42497] New pathlib.Path attribute
ThatXliner
report at bugs.python.org
Sun Nov 29 16:46:04 EST 2020
ThatXliner <bryan.hu.2020 at gmail.com> added the comment:
Ok, so I just made a patch implementing this using os.access. It adds the following methods to pathlib.Path
- can_read = Returns True if the user can read the path
- can_write = Returns True if the user can write on the path
- can_execute = Returns True if the user can execute the path
These are implemented via
- return os.access(str(self), os.R_OK)
- return os.access(str(self), os.W_OK)
- return os.access(str(self), os.X_OK)
respectively.
----------
keywords: +patch
Added file: https://bugs.python.org/file49637/implement.patch
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42497>
_______________________________________
More information about the Python-bugs-list
mailing list