cleanUrl: "snippet/cpu-and-ram-usage-in-python"
description: "Python에서 CPU와 RAM 사용량을 출력하는 방법에 대해 알아봅니다."
import psutil

# CPU usage.
psutil.cpu_percent()

# Memory usage.
psutil.virtual_memory().percent

# Memory usage in GB.
psutil.virtual_memory().used / 2 ** 30

# Total memory in GB.
psutil.virtual_memory().total / 2 ** 30