/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/py-502-102-012/main.py
20 строк
620 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
import shutil import os def check_disk_usage(path='/'): total, used, free = shutil.disk_usage(path) percent_free = (free / total) * 100 print(f"\nДиск: {path}") print(f"Всего: {total // (2**30)} GB") print(f"Занято: {used // (2**30)} GB") print(f"Свободно: {free // (2**30)} GB") print(f"Свободно (%): {percent_free:.2f}%") if percent_free < 20: print("Внимание: Свободного места менее 20%!") if __name__ == "__main__": root_path = "/" if os.name != 'nt' else "C:\\" check_disk_usage(root_path)