微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python读取内存和空闲内存

# This is a sample Python script.import psutildef get_mem_info():mem = psutil.virtual_memory()mem1 = str(mem.total / 1024 / 1024 / 1024)mem2 = str(mem.free / 1024 / 1024 / 1024)print("内存总数为:", mem1[0:3], "G")print("空闲内存总数:", mem2[0:3], "G")# Press Ctrl+F8 to toggle the breakpoint.# Press the green button in the gutter to run the script.if __name__ == '__main__':get_mem_info()# get_one_video("D:/11111.mp4")# get_mem_info()# print_hi('PyCharm')# See PyCharm help at https://www.jetbrains.com/help/pycharm/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐