同时运行许多具有解析论点的Python脚本
我有一个带有解析参数的Python脚本“ client_k.py”。为了运行它,我在终端python client_k 1
中编写。如果我想在终端同时运行100个客户端,那么是否可以使其与编写python client_k.py 1& python client_k.py 2& ...& python client_k.py 100
手工? 提前致谢。
I have a python script with a parse argument 'client_k.py'. To run it I write in the terminal python client_k 1
. If I want to run 100 clients at the same time in the terminal, is there a way to make it apart from writing python client_k.py 1 & python client_k.py 2 & ... & python client_k.py 100
by hand?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个新的Python脚本,并多次运行您的脚本。
client_k.py示例:
run_client_k.py:
如果运行它,输出将是:
或,如果您必须一次执行所有命令,例如在描述中,可以使用子程序:
You could create a new python script with a for to run you script several times.
client_k.py example:
run_client_k.py:
If you run it, your output would be:
Or, if you have to execute all the commands at once such as in your description, you could do it using a subprocess: