在python中,如何进行非阻塞系统调用?

Ros*_*ers 8 python

在Python中,是否可以在不脱离线程的情况下进行非阻塞系统调用?即,我可以避免:

import thread
thread.start_new_thread(os.system,('cmd',))
Run Code Online (Sandbox Code Playgroud)

jld*_*ont 10

使用子进程模块(Popen)并将结果写入文件.您可以"等待"子流程终止或继续其他业务并轮询文件中的结果等.