File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -3141,6 +3141,23 @@ features:
3141
3141
3142
3142
File mode: file type and file mode bits (permissions).
3143
3143
3144
+ .. note ::
3145
+
3146
+ ``st_mode `` is an **int ** bitmask that combines the file type and the
3147
+ permission bits. If you expect POSIX-style values like ``755 `` or ``644 ``,
3148
+ render the value in octal and/or mask out only the permission bits. For example:
3149
+
3150
+ .. code-block :: pycon
3151
+
3152
+ >>> import os, stat
3153
+ >>> m = os.stat("somefile").st_mode
3154
+ >>> oct(m) # includes the file-type bits (e.g. 0o100...)
3155
+ '0o100755'
3156
+ >>> oct(stat.S_IMODE(m)) # permissions only
3157
+ '0o755'
3158
+ >>> stat.filemode(m) # human-readable form
3159
+ '-rwxr-xr-x'
3160
+
3144
3161
.. attribute :: st_ino
3145
3162
3146
3163
Platform dependent, but if non-zero, uniquely identifies the
You can’t perform that action at this time.
0 commit comments