您好我想继续获取CPU信息,但我只能使用此代码获取一个如何修复它?
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)