Python3 os.statvfs() 方法

Python 3 教程 · 2019-02-07 19:56:44

概述

os.statvfs() 方法用于返回包含文件描述符fd的文件的文件系统的信息。

语法

statvfs()方法语法格式如下:

os.statvfs([path])

参数

  • path -- 文件路径。

返回值

返回的结构:

  • f_bsize: 文件系统块大小

  • f_frsize: 分栈大小

  • f_blocks: 文件系统数据块总数

  • f_bfree: 可用块数

  • f_bavail:非超级用户可获取的块数

  • f_files: 文件结点总数

  • f_ffree: 可用文件结点数

  • f_favail: 非超级用户的可用文件结点数

  • f_fsid: 文件系统标识 ID

  • f_flag: 挂载标记

  • f_namemax: 最大文件长度

实例

以下实例演示了 statvfs() 方法的使用:

#!/usr/bin/python3

import os, sys

# 显示 "a1.py" 文件的 statvfs 信息
stinfo = os.statvfs('a1.py')

print (stinfo)

执行以上程序输出结果为:

posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1909350L, f_bfree=1491513L,
f_bavail=1394521L, f_files=971520L, f_ffree=883302L, f_fvail=883302L, f_flag=0,
f_namemax=255)

点击查看所有 Python 3 教程 文章: https://codercto.com/courses/l/10.html

查看所有标签

Head First Rails

Head First Rails

David Griffiths / O'Reilly Media / 2008-12-30 / USD 49.99

Figure its about time that you hop on the Ruby on Rails bandwagon? You've heard that it'll increase your productivity exponentially, and allow you to created full fledged web applications with minimal......一起来看看 《Head First Rails》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具