python获得linux物理内存大小:
import re def get_physical_memory_in_kb(): meminfo = open('/proc/meminfo').read() matched = re.search(r'^MemTotal:/s+(/d+)', meminfo) return int(matched.groups()[0])
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8267.html
python获得linux物理内存大小:
import re def get_physical_memory_in_kb(): meminfo = open('/proc/meminfo').read() matched = re.search(r'^MemTotal:/s+(/d+)', meminfo) return int(matched.groups()[0])
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8267.html