stat
The stat module defines constants and functions for interpreting the results of os.stat(), os.fstat(), and os.lstat(). These functions return a 10-tuple containing file information. The following variables define the indices within the tuple for certain items and are listed in the order in which they commonly appear in the tuple:
Variable | Description |
---|---|
ST_MODE | Inode protection mode |
ST_INO | Inode number |
ST_DEV | Device the inode resides on |
ST_NLINK | Number of links to the inode |
ST_UID | User ID of the owner |
ST_GID | Group ID of the owner |
ST_SIZE | File size in bytes |
ST_ATIME | Time of last access |
ST_MTIME | Time of last modification |
ST_CTIME | Time of last status change |
The following functions can be used to test file properties given the mode value returned using os.stat(path)[stat.ST_MODE] ...
Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.