Name
stat
Synopsis
stat(path)Returns a value x that is a tuple of 10
integers that provide information about a file or subdirectory
path. See Section 10.2.5 later in this chapter for
details about using the returned tuple. In Python 2.2 and later,
x is of type
stat_result. You can still use
x as a tuple, but you can also access
x’s items as read-only
attributes x
.st_mode,
x
.st_ino, and so on,
using as attribute names the lowercase versions of the names of
constants listed later in Table 10-1.
A module named statcache also supplies a function
named stat, like os.stat but
with an enhancement: the returned tuple (or
stat_result instance) is cached, so repeated
requests about the same file run faster. statcache
cannot detect changes automatically, so you should use it only for
stable files that do not change in the time between
stat requests.
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.
Read now
Unlock full access