How to check that path has sticky bit in python?

How to check with python if the path has a sticky bit?

+2
source share
2 answers
import os def is_sticky(path): return os.stat(path).st_mode & 01000 == 01000 
+8
source

os.stat () will return file information. The first item will be the mode. Then you can use some bit arithmetic to get a sticky bit. The sticky bit has an octal value of 1000.

+2
source

All Articles