Python的stat()方法在给定路径上执行统计系统调用。
语法
以下是stat()方法的语法 -
os.rmdir(path)
参数
- path - 这是要统计信息是必需的路径。
返回值
以下是stat结构的成员列表:
- st_mode- 保护位。
- st_ino- inode编号。
- st_dev- 设备。
- st_nlink- 硬链接数。
- st_uid- 所有者的用户ID。
- st_gid- 所有者的组ID。
- st_size- 文件大小(以字节为单位)。
- st_atime- 最近访问的时间。
- st_mtime- 最近修改内容的时间。
- st_ctime- 最近元数据更改的时间。
示例
以下示例显示了stat()方法的用法。
# !/usr/bin/python3
import os, sys
# showing stat information of file "foo.txt"
statinfo = os.stat('foo.txt')
print (statinfo)
当运行上述程序时,它会产生以下结果 -
os.stat_result(st_mode = 33206, st_ino = 281474976797706, 
   st_dev = 1017554828, st_nlink = 1, st_uid = 0, st_gid = 0,  
   st_size = 13, st_atime = 1455649253, st_mtime = 1438077266, st_ctime = 1455560006)
						上一篇:
								Python os模块方法
												下一篇:
								Python异常处理
												
						
						
					
					
					