python psutil 获取磁盘信息

C:\Users\chenhui.XXZX>pip3 install psutil
Collecting psutil
  Downloading https://files.pythonhosted.org/packages/7c/58/f5d68ddca37480d8557b8566a20bf6108d7e1c6c9b9208ee0786e0cd012b/psutil-5.6.3-cp37-cp37m-win_amd64.whl (234kB)
    100% |████████████████████████████████| 235kB 531kB/s
Installing collected packages: psutil
Successfully installed psutil-5.6.3
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\chenhui.XXZX>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_partitions()
[sdiskpart(device='C:\\', mountpoint='C:\\', fstype='NTFS', opts='rw,fixed'), sdiskpart(device='D:\\', mountpoint='D:\\', fstype='CDFS', opts='ro,cdrom')]
>>> psutil.disk_usage('/')
sdiskusage(total=254721126400, used=44705189888, free=210015936512, percent=17.6)
>>> psutil.disk_io_counters()
sdiskio(read_count=331164, write_count=462888, read_bytes=9068782080, write_bytes=7760820736, read_time=224, write_time=1380)
>>>

你可能感兴趣的:(python psutil 获取磁盘信息)