1#Iterates through all the programs running in your system and checks for the one in the string
2import psutil
3"someProgram" in (p.name() for p in psutil.process_iter())
1import subprocess
2
3s = subprocess.check_output('tasklist', shell=True)
4if "cmd.exe" in s:
5 print s