How to control a Thread via input()?
问题 I want to run a code with process parallel to my main code but also want to access its parameters or start/stop the process via command prompt. my machine is win7 64bit. Something in mind is: from multiprocessing import Process class dllapi(): ... def apiloop(params, args): apiclient = dllapi(**args) while True: apiclient.cycle() params = [....] def mainloop(args): p = Process(target = apiloop, args=(params, args, )) while True: cmd = input() if cmd == 'kill': p.terminate() if cmd == 'stop':