Getting CPU temperature using Python?

There is a newer “sysfs thermal zone” API (see also LWN article and Linux kernel doc) showing temperatures under e.g.

/sys/class/thermal/thermal_zone0/temp

Readings are in thousandths of degrees Celcius (although in older kernels, it may have just been degrees C).

Leave a Comment