import subprocess notepadProcess = subprocess.Popen("Notepad") while notepadProcess.poll() is None: print 'still running' reply = raw_input("Kill process ? (type yes) ") print '>>|'+reply.strip()+'|<<' if reply.strip()=='yes': print "closing process" notepadProcess.terminate()
No comments:
Post a Comment