我有十個不同的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