You can use the psutil and os modules in Python to get the CPU temperature of your system in Fahrenheit. Here's a sample code that does that:
main.py477 chars16 linesThe sensors_temperatures() function of psutil module returns the temperature of various system components including CPU as a namedtuple. We can use "coretemp" as the key to get the temperature tuple of the CPU. The current attribute of the namedtuple object contains the current temperature in Celsius which we convert to Fahrenheit by applying the formula temperature * 9/5 + 32. Finally, we round off the temperature to two decimal places using the round() method.
gistlibby LogSnag