【问题标题】:Whats the unit (bytes, MB, ...) that this python function returns?这个 python 函数返回的单位(字节,MB,...)是什么?
【发布时间】:2021-11-17 05:00:32
【问题描述】:

非常快速的问题。我一直在 python 中使用这个函数来获取 RAM 使用情况:

total_memory, used_memory, free_memory = map(int, os.popen('free -t -m').readlines()[-1].split()[1:])

你知道它返回的答案是字节还是 MB 或其他?

【问题讨论】:

标签: python memory operating-system ram


【解决方案1】:

来自free 的手册页:

-m, --mebi
以 MB 为单位显示内存量。

所以它以兆字节为单位。

【讨论】:

    猜你喜欢
    • 2021-02-02
    • 2020-02-21
    • 1970-01-01
    • 2016-03-30
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    相关资源
    最近更新 更多