Quantcast
Channel: User Louis Maddox - Stack Overflow
Viewing all articles
Browse latest Browse all 51

Answer by Louis Maddox for Changing file permission in Python

$
0
0

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

Viewing all articles
Browse latest Browse all 51

Trending Articles