> I want to run several subprocesses. Like so: > > p1 = Popen("mycmd1" + " myarg", shell=True) > p2 = Popen("mycmd2" + " myarg", shell=True) > .... > pn = Popen("mycmdn" + " myarg", shell=True) > > What would be the most elegant and secure way to run all n > subprocesses in parallel?
They already run in parallel. Depending on your command this may not be secure due to race conditions. You might want to drop shell=True and use a list as arguments instead. The shell=True argument is frowned upon and should only be used if your really, really need a shell. -- http://mail.python.org/mailman/listinfo/python-list