Files
AwesomePolytech/OSs/lab-virt-win/util.py
2025-10-10 00:20:58 +03:00

21 lines
546 B
Python

#/usr/bin/python3
# чтобы удобнее было посмотреть разницу
import re
with open("report.txt", 'r') as f:
lines = f.readlines()
while len(lines) > 0:
for line in lines[1:4]:
line = line.strip()
m = re.match(r"([\w ]+): (\d+)/(\d+)", line)
assert m
name = m.group(1)
total = int(m.group(2))
avail = int(m.group(3))
print(f"{name}: {total}/{avail} ({avail/total*100:.2f}%, "
f"delta: {total - avail})")
print()
lines = lines[7:]