Python method chflags() sets the flags of the path to the numeric flags. The flags may take a combination (bitwise OR) of the various values described below.
Note − This method is available in Python version 2.6 onwards. Most of the flags can be changed by super-users only.
Following is the syntax for chdir() method:
os.chflags(path, flags)
This method does not return any value.
The following example shows the usage of chflags() method.
#!/usr/bin/python import os import stat path = "/tmp/foo.txt" # Set a flag so that file may not be renamed or deleted. flags = os.SF_NOUNLINK retval = os.chflags( path, flags) print "Return Value: %s" % retval
When we run the above program, it produces the following result:
Return Value : None
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.