(python) meaning of st_mode
Can anyone tell me what is the meaning o开发者_开发问答f the number from the ST_MODE
function?
Example:
>>>import os
>>>stat = os.stat('/home')
>>>print stat.st_mode
16877
it prints 16877
. What is that for?
It's the permission bits of the file.
>>> oct(16877)
'040755'
See the various stat.S_*
attributes for more info.
The standard stat
module can help you interpret these values from os.stat
:
The stat module defines constants and functions for interpreting the results of os.stat(), os.fstat() and os.lstat() (if they exist). For complete details about the stat(), fstat() and lstat() calls, consult the documentation for your system.
精彩评论