I have a Python program for Linux almost looks like this one :
import os
import time
process = os.popen(\"top\").readlines()
time.sleep(1)
os.popen(\"kill
What I would do, rather than this approach, is to examine the program you are trying to get information from and determine the ultimate source of that information. It may be an API call or device node. Then, write some python that gets it from the same source. That eliminates the problems and overhead of "scraping" "cooked" data.