Python/Python Programming
[Python] Windows OS Disk Usage Check. (윈도우 운영체제 디스크 사용량 체크)
Pydole
2019. 10. 18. 21:40
import shutil.disk_usage(drive) : 드라이브의 전체용량, 사용량, 잔여량 정보를 리턴
import shutil
drive = 'c:'
c = dict([x for x in zip(['total','used','free'], shutil.disk_usage(drive))])
print(c)
print(drive,'Partition used %d %%' %(c['used']/c['total']*100))
-----------------------------------------------------------------------------
{'total': 255005159424, 'used': 224621703168, 'free': 30383456256}
c: Partition used 88 %