Memory Information
Read the memory information from the system file /proc/meminfo.
Example:
def get_mem_info():
mem_info = ""
f_mem_info = open("/proc/meminfo")
try:
for line in f_mem_info:
if (line.find("MemTotal") == 0):
mem_info += line.strip()+ ", "
elif (line.find("SwapTotal") == 0):
mem_info += line.strip()
break
print("mem_info---- {:s}".format(mem_info))
finally:
f_mem_info.close()
Parent topic: Python