有没有一种方法可以使用python启动/停止linux进程? [英] is there a way to start/stop linux processes with python?

查看:480
本文介绍了有没有一种方法可以使用python启动/停止linux进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够启动一个过程,然后在之后将其杀死

I want to be able to start a process and then be able to kill it afterwards

推荐答案

看看 subprocess 模块. 您还可以通过os模块使用像fork()这样的低级基元.

Have a look at the subprocess module. You can also use low-level primitives like fork() via the os module.

这篇关于有没有一种方法可以使用python启动/停止linux进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆