1

I couldn't find an answer in the internet or stackoverflow but I have tried this method but it's not good one

from os import popen
output  = popen("free -ht").read()
print(output[154:-90])
output: 2.4G

Is there any python library for this or at least a solution.

martineau
  • 119,623
  • 25
  • 170
  • 301
s0n0fj0hn
  • 33
  • 5
  • See [Getting error when trying to round available RAM](https://stackoverflow.com/questions/68697486/getting-error-when-trying-to-round-available-ram?r=SearchResults&s=1|102.6191) for how to get current ram. So, basically use `import psutil psutil.virtual_memory().available`. – Sylvester Kruin Sep 26 '21 at 15:47
  • Which "kind" of available memory (there are many), and on which OS? – Alexander Sep 26 '21 at 15:47
  • 4
    You can use this topic https://stackoverflow.com/questions/11615591/available-and-used-system-memory-in-python – Süleyman Özgür Özarpacı Sep 26 '21 at 15:49
  • 2
    There's also [this question](https://stackoverflow.com/questions/17718449/determine-free-ram-in-python?r=SearchResults&s=9|53.5024) – Sylvester Kruin Sep 26 '21 at 15:50
  • 1
    Does this answer your question? [Available and used System Memory in Python?](https://stackoverflow.com/questions/11615591/available-and-used-system-memory-in-python) – Gino Mempin Oct 04 '21 at 15:41

0 Answers0