In Python 3.4+, when working with pathlib.Path
objects, you can call chmod()
directly as a method on the path object. The following example is given in the docs:
>>> p = Path('setup.py')>>> p.stat().st_mode33277>>> p.chmod(0o444)>>> p.stat().st_mode33060