cat = lambda file: open(file, 'r').read().strip()
temp = cat('/sys/class/thermal/thermal_zone0/temp')
print '%1.f°C' % (float(temp) / 1000)
# http://www.mjmwired.net/kernel/Documentation/hwmon/sysfs-interface
$ cat /sys/class/hwmon/hwmon0/temp1_input
Reference :
Getting CPU temperature using Python? - Stack Overflow
沒有留言:
張貼留言