Python os.lchmod() Method
Example
Change the mode of path to the numeric mode :
#Import os and stat Library
import os,stat
#Change file mode to Write by owner
os.lchmod("/tmp/test.txt", stat.S_IWRITE)
Definition and Usage
The os.lchmod()
method is used to change the mode of path to the numeric mode like os.chmod()
, but do not follow symbolic links.
This is equivalent to os.chmod(path, mode, follow_symlinks=False)
.
Note: Available on UNIX and WINDOWS platforms.
Syntax
os.lchmod(path, mode)
Parameter Values
Parameter | Description |
---|---|
path | Required. Specifies the file path to set the mode |
mode | Required. Specifies the mode(s). Can be a combination of one or more
mode constants:
|
Technical Details
Return Value: | None |
---|---|
Python Version: | 2.6 |
Change Log: | 3.6 - Accepts a path-like object |