fsutil.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pykit 作者: baishancloud 项目源码 文件源码
def get_path_usage(path):

    space_st = os.statvfs(path)

    # f_bavail: without blocks reserved for super users
    # f_bfree:  with    blocks reserved for super users
    avail = space_st.f_frsize * space_st.f_bavail

    capa = space_st.f_frsize * space_st.f_blocks
    used = capa - avail

    return {
        'total': capa,
        'used': used,
        'available': avail,
        'percent': float(used) / capa,
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号