On this page
  1. stat.filemode
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from stat import filemode
help(filemode)

Linked from

Related notes