简体   繁体   English

在python中同时运行两个程序的最佳方式

[英]The best way to run two programs simultaneously in python

I'm trying to run two programs simultaneously in python, but the examples I found are always pretty over-complicated.我试图在 python 中同时运行两个程序,但我发现的例子总是非常复杂。 Is there a "best" way to run two programs at once?有没有一种“最佳”方式可以同时运行两个程序?

Two python programs are once?两个python程序是一次? Write a wrapper that starts the two scripts.编写一个包装器来启动这两个脚本。 You can achieve this using the subprocess module.您可以使用 subprocess 模块来实现这一点。

import subprocess
subprocess.call(['python', 'somescript.py', somescript_arg1, somescript_val1,...]).

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM