OS File 中的 os.fstatvfs(fd)函数

首页 / Python2入门教程 / OS File 中的 os.fstatvfs(fd)函数

Python方法fstatvfs()返回有关包含与文件描述符fd关联的文件系统的信息。

    os.fstatvfs(fd) - 语法

    os.fstatvfs(fd)
    • fd  -  这是要返回其系统信息的文件描述符。

    os.fstatvfs(fd) - 返回值

    此方法返回有关包含关联文件的文件系统的信息。

    os.fstatvfs(fd) - 示例

    以下示例显示了fstatvfs()方法的用法。

    链接:https://www.learnfk.comhttps://www.learnfk.com/python/os-fstatvfs.html

    来源:LearnFk无涯教程网

    #!/usr/bin/python
    
    import os, sys
    
    # Open a file
    fd=os.open( "foo.txt", os.O_RDWR|os.O_CREAT )
    
    # Now get  the touple
    info=os.fstatvfs(fd)
    
    print "File Info :", info
    
    # Now get maximum filename length
    print "Maximum filename length :%d" % info.f_namemax:
    
    # Now get free blocks
    print "Free blocks :%d" % info.f_bfree
    
    # Close opened file
    os.close( fd)

    当无涯教程运行上面的程序时,它产生以下输出-

    无涯教程网

    File Info : (4096, 4096, 2621440L, 1113266L, 1113266L, 
                 8929602L, 8764252L, 8764252L, 0, 255)
    Maximum filename length :255
    Free blocks :1113266

    祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

    技术教程推荐

    人工智能基础课 -〔王天一〕

    微服务架构核心20讲 -〔杨波〕

    代码精进之路 -〔范学雷〕

    TensorFlow快速入门与实战 -〔彭靖田〕

    重学前端 -〔程劭非(winter)〕

    零基础学Java -〔臧萌〕

    小马哥讲Spring核心编程思想 -〔小马哥〕

    成为AI产品经理 -〔刘海丰〕

    B端体验设计入门课 -〔林远宏(汤圆)〕

    好记忆不如烂笔头。留下您的足迹吧 :)