def cpu_app():
print("CPU") #启动一个线程
t=threading.Thread(target=cpu_app,args=())
t.daemon = True
t.start()
#打印出当前线程的名称和id
print(threading.currentThread().name)
print(threading.currentThread().ident)
杀进程的话,使用
handle=os.getpid()
subprocess.Popen("taskkill /F /T /PID " + str(handle) , shell=True)