def disksinfo(self):
values = []
disk_partitions = psutil.disk_partitions(all=False)
for partition in disk_partitions:
usage = psutil.disk_usage(partition.mountpoint)
device = {'device': partition.device,
'mountpoint': partition.mountpoint,
'fstype': partition.fstype,
'opts': partition.opts,
'total': usage.total,
'used': usage.used,
'free': usage.free,
'percent': usage.percent
}
values.append(device)
values = sorted(values, key=lambda device: device['device'])
return values
评论列表
文章目录