1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Python获取Linux系统内存情况

Python获取Linux系统内存情况

时间:2018-07-16 11:48:40

相关推荐

Python获取Linux系统内存情况

后端开发|Python教程

代码片段,代码分享,PHP代码分享,Java代码分享,Ruby代码分享,Python代码分享,HTML代码分享,CSS代

后端开发-Python教程

[Python]代码

淘宝自由布局工具php源码,vscode vivado,ubuntu性能监控,tomcat包,华为备份 sqlite,怎么开免费云服务器,js 日期插件 可输入,怎样选择前端框架,网络爬虫的分类,php背景,seo优化班,英雄联盟网站模板,网页上左右框架代码,奇妙3.0模板,手机端充值页面模板,扁平管理系统模板,仿同城信息手机版程序lzw

import subprocessimport re keydic = {"MemTotal":"总内存(单位G)","MemFree":"剩余内存(单位G)","MemAvailable":"可用内存(单位G)","Cached":"缓存内存(单位G)"} def command(command): p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) resultDic = {} for line in p.stdout.readlines(): line = str(line,encoding="utf-8") result = re.split("\s*",line) if result[0][:-1] in keydic: resultDic[keydic[result[0][:-1]]] = "%.2f" %(int(result[1])/(1024**2)) return resultDic if __name__ == "__main__": print(command("cat /proc/meminfo"))

带后台管理的网站源码,ubuntu中软件卸载,python爬虫发送邮件,php laydate,Seo029196lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。