Skip to content

Instantly share code, notes, and snippets.

@funvill
funvill / gist:5252169
Last active June 17, 2022 02:20
Get the system stats on the raspberry pi or any linux system in python
# Return CPU temperature as a character string
def getCPUtemperature():
res = os.popen('vcgencmd measure_temp').readline()
return(res.replace("temp=","").replace("'C\n",""))
# Return RAM information (unit=kb) in a list
# Index 0: total RAM
# Index 1: used RAM
# Index 2: free RAM
def getRAMinfo():