How to check that a path has a sticky bit in python?
How to check with python if a path has the sticky bit set?
Asked by: Max288 | Posted: 24-09-2021
Answered by: Carina412 | Posted: 25-10-2021
import os def is_sticky(path): return os.stat(path).st_mode & 01000 == 01000
os.stat() will return a tupple of information about the file. The first item will be the mode. You would then be able to use some bit arithmetic to get for the sticky bit. The sticky bit has an octal value of 1000.Answered by: Ryan400 | Posted: 25-10-2021