diskpython_python – shutil.disk_usage()中的差异

我正在使用shutil.disk_usage()函数来查找特定路径的当前磁盘使用情况(可用,使用的数量等).据我所知,这是os.statvfs()调用的包装器.我发现它没有给出我期望的答案,与Linux中“du”的输出相比.

出于公司隐私原因,我已经模糊了下面的一些路径,但输出和代码在其他方面都没有被删除.我使用的是Python 3.3.2 64位版本.

#!/apps/python/3.3.2_64bit/bin/python3

# test of shutils.diskusage module

import shutil

BytesPerGB = 1024 * 1024 * 1024

(total, used, free) = shutil.disk_usage("/data/foo/")

print ("Total: %.2fGB" % (float(total)/BytesPerGB))

print ("Used: %.2fGB" % (float(used)/BytesPerGB))

(total1, used1, free1) = shutil.disk_usage("/data/foo/utils/")

print ("Total: %.2fGB" % (float(total1)/BytesPerGB))

print ("Used: %.2fGB" % (float(used1)/BytesPerGB))

哪个输出:

/data/foo/drivecode/me % disk_usage_test.py

Total: 609.60GB

Used: 291.58GB

Total: 609.60GB

Used: 291.58GB

正如

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值