Skip to content

Instantly share code, notes, and snippets.

@Shrhawk
Created April 7, 2017 12:56
Show Gist options
  • Save Shrhawk/b515cbf8e6c1ae888a2c3300b280150d to your computer and use it in GitHub Desktop.
Save Shrhawk/b515cbf8e6c1ae888a2c3300b280150d to your computer and use it in GitHub Desktop.
temperature_sensors
import sys
import re
import subprocess
sensorsOut = subprocess.getoutput('sensors')
trapperStdout = []
boardTempRe = re.findall(r'CPU:\s+\+(\d+)\.\d', sensorsOut, re.I)
cpuTempRe = re.findall(r'(?:Core\s+\d+|Core\d+\s+Temp):\s+\+(\d+)\.\d', sensorsOut, re.I)
Cores = re.findall(r'(?:Core\s+(\d+):)', sensorsOut, re.I)
print(boardTempRe)
print(cpuTempRe)
print(Cores)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment