Raspberry Pi vcgencmd command to view the hardware status
1.vcgencmd commands can be seen instructions contact vcgencmd
2. Read the Raspberry Pi cpu temperature in python
Because os.popen returns a file, so use readline () to read the file
print(os.popen('vcgencmd measure_temp').readline())
It may also be replace function that returns a temperature value
import os rec = os.popen('vcgencmd measure_temp').readline() print(rec.replace("temp=","").replace("'C\n",""))