Skip to Content
Python: Essential Reference, Third Edition
book

Python: Essential Reference, Third Edition

by David Beazley
February 2006
Intermediate to advanced content levelIntermediate to advanced
648 pages
14h 53m
English
Sams
Content preview from Python: Essential Reference, Third Edition

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:

VariableDescription
ST_MODEInode protection mode
ST_INOInode number
ST_DEVDevice the inode resides on
ST_NLINKNumber of links to the inode
ST_UIDUser ID of the owner
ST_GIDGroup ID of the owner
ST_SIZEFile size in bytes
ST_ATIMETime of last access
ST_MTIMETime of last modification
ST_CTIMETime 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] ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python: Essential Reference

Python: Essential Reference

David M. Beazley

Publisher Resources

ISBN: 0672328623Purchase book