我试图将disk_usage报告模仿为
In [147]: subprocess.Popen("df -h", shell=True)
Out[147]: <subprocess.Popen at 0x106f7e240>
Filesystem Size Used Avail Use% Mounted on
/dev/disk1s1 113G 92G 17G 85% /
/dev/disk1s4 113G 4.1G 17G 20% /private/var/vm
/dev/disk2s1 121G 33G 89G 27% /Volumes/Transcend
尝试dict理解
In [150]: disk_usage = shutil.disk_usage('/')
In [151]: disk_usage
Out[151]: usage(total=121123069952, used=98613166080, free=17531617280)
In [153]: { k : str(round(v/(2**30),2)) + "G" for k, v in disk_usage._asdict().items()}
Out[153]: {'total': '112.8G', 'used': '91.84G', 'free': '16.33G'}
我该如何使用python高级工具的功能方式完成