我有十个不同的adb命令,并希望作为一个单独的进程同时执行它。我已经使用了子进程模块&,但进程似乎并没有同时运行。有没有在Python中同时运行进程的有效方法?我的代码段低于如何通过python运行adb命令?
def run(com):
sub = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return sub.communicate()
cmd =[adb commands 1 to 10]
for i in cmd:
run(i)
我想这可能是有用的http://stackoverflow.com/questions/18864859/python-executing-multiple-functions-simultaneously – Andersson