stat — 解释 stat() 结果

源代码: Lib/stat.py


The stat 模块定义的常量和函数用于解释结果为 os.stat() , os.fstat() and os.lstat() (若存在)。对于完整细节有关 stat() , fstat() and lstat() 调用,请翻阅系统文档编制。

3.4 版改变: stat 模块由 C 实现。

The stat 模块定义下列函数,以测试特定文件类型:

stat. S_ISDIR ( mode )

Return non-zero if the mode is from a directory.

stat. S_ISCHR ( mode )

Return non-zero if the mode is from a character special device file.

stat. S_ISBLK ( mode )

Return non-zero if the mode is from a block special device file.

stat. S_ISREG ( mode )

Return non-zero if the mode is from a regular file.

stat. S_ISFIFO ( mode )

Return non-zero if the mode is from a FIFO (named pipe).

stat. S_ISLNK ( mode )

Return non-zero if the mode is from a symbolic link.

stat. S_ISSOCK ( mode )

Return non-zero if the mode is from a socket.

stat. S_ISDOOR ( mode )

Return non-zero if the mode is from a door.

Added in version 3.4.