How would I use Python to determine what programs are currently running. I am on Windows.
import os
os.system('WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid')
f = open("C:\ProcessList.txt")
plist = f.readlines()
f.close()
Now plist contains a formatted whitespace-separated list of processes:
This should be simple to parse with python. Note that the first row of data are labels for the columns, and not actual processes.
Note that this method only works on windows!