小白教程
所有教程
关于
Search
172.69.58.58
172.69.58.58
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 os fstatvfs”的源代码
本页内容
上一节:
Python3_os_fstat
下一节:
Python3_os_fsync
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:os.fstatvfs(fd)}}[[Category:python3 os file methods|18]] = Python3 os.fstatvfs() 方法 = [[python3 os file methods|Python3 OS 文件/目录方法]] === 概述 === os.fstatvfs() 方法用于返回包含文件描述符fd的文件的文件系统的信息,Python 3.3 相等于 statvfs()。。 Unix上可用。 fstatvfs 方法返回的结构: * '''f_bsize:''' 文件系统块大小 * '''f_frsize:''' 分栈大小 * '''f_blocks:''' 文件系统数据块总数 * '''f_bfree:''' 可用块数 * '''f_bavail:'''非超级用户可获取的块数 * '''f_files:''' 文件结点总数 * '''f_ffree:''' 可用文件结点数 * '''f_favail:''' 非超级用户的可用文件结点数 * '''f_fsid:''' 文件系统标识 ID * '''f_flag:''' 挂载标记 * '''f_namemax:''' 最大文件长度 === 语法 === '''fstatvfs()'''方法语法格式如下: <sample title="" desc="" lang="python" hererun="1"> os.fstatvfs(fd) </sample> === 参数 === * '''fd''' -- 文件的描述符。 === 返回值 === 返回包含文件描述符fd的文件的文件系统的信息。 == 以下实例演示了 fstatvfs() 方法的使用: <sample title="" desc="" lang="python" hererun="1"> #!/usr/bin/python3 import os, sys # 打开文件 fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT ) # 获取元组 info = os.fstatvfs(fd) print ("文件信息 :", info) # 获取文件名最大长度 print ("文件名最大长度 :%d" % info.f_namemax) # 获取可用块数 print ("可用块数 :%d" % info.f_bfree) # 关闭文件 os.close( fd) </sample> 执行以上程序输出结果为: <sample title="" desc="" lang="python" hererun="1"> 文件信息 : (4096, 4096, 2621440L, 1113266L, 1113266L, 8929602L, 8764252L, 8764252L, 0, 255) 文件名最大长度 :255 可用块数 :1113266 </sample> [[python3 os file methods|Python3 OS 文件/目录方法]]
返回至“
Python3 os fstatvfs
”。
上一节:
Python3_os_fstat
下一节:
Python3_os_fsync