Interpreting os.lstat()

Hrvoje Niksic hniksic at xemacs.org
Thu Jul 19 04:27:43 EDT 2007


Adrian Petrescu <apetresc at uwaterloo.ca> writes:

> I checked the online Python documentation at http://python.org/doc/1.5.2/lib/module-stat.html
> but it just says to "consult the documentation for your system.".

The page you're looking for is at
http://www.python.org/doc/current/lib/os-file-dir.html .  For lstat it
says "Like stat(), but do not follow symbolic links."  For stat it
says:

    Perform a stat() system call on the given path. The return value
    is an object whose attributes correspond to the members of the
    stat structure, namely: st_mode (protection bits), st_ino (inode
    number), st_dev (device), st_nlink (number of hard links), st_uid
    (user ID of owner), st_gid (group ID of owner), st_size (size of
    file, in bytes), st_atime (time of most recent access), st_mtime
    (time of most recent content modification), st_ctime (platform
    dependent; time of most recent metadata change on Unix, or the
    time of creation on Windows)
[...]
    For backward compatibility, the return value of stat() is also
    accessible as a tuple of at least 10 integers giving the most
    important (and portable) members of the stat structure, in the
    order st_mode, st_ino, st_dev, st_nlink, st_uid, st_gid, st_size,
    st_atime, st_mtime, st_ctime. More items may be added at the end
    by some implementations. The standard module stat defines
    functions and constants that are useful for extracting information
    from a stat structure. (On Windows, some items are filled with
    dummy values.)



More information about the Python-list mailing list