On this page
stat.filemode
Up: stat
Rel: stat
Ref: docs.python.org — stat.filemode
Tags: #public #python3 #stdlib #stat
Import
import stat
from stat import filemode
Signature & Overview
stat.filemode(object, /)
Convert a file's mode to a string of the form '-rwxrwxrwx'
Usage
import os, stat
mode_str = stat.filemode(os.stat('.').st_mode)
assert mode_str.startswith('d') and len(mode_str) == 10
Gotchas
- Formats
st_modelikels -l(e.g.'-rwxr-xr-x','drwxr-xr-x').
REPL Inspect
from stat import filemode
help(filemode)
Linked from
Related notes
- tuts/python3/stdlib_module/stat Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib
- tuts/c/stdlib/ctype/isspace shared tags: #stdlib
- tuts/c/stdlib/ctype/tolower shared tags: #stdlib