获取温度信息
使用shell
$ vcgencmd measure_temp temp=40.8'C
$ cat /sys/class/thermal/thermal_zone0/temp
40780
使用python
# -*- encoding: utf-8 -*- file = open("/sys/class/thermal/thermal_zone0/temp") temp = float(file.read()) / 1000 file.close() print "temp : %.3f" %temp