Hello i want to get CPU information continuously but i can only get one with this code how can i fix it ?
import subprocess
import time
while 1:
top = subprocess.Popen(['top','-b','n1'],stdout = subprocess.PIPE)
grep = subprocess.Popen(['grep','-i','Cpu(s)'] stdin = top.stdout, stdout = subprocess.PIPE , stderr = subprocess.STDOUT)
cut = subprocess.Popen(['cut','-c','-13'] , stdin = grep.stdout , stdout = subprocess.PIPE)
print output
time.sleep(3)