How to start a background process in Python?

后端 未结 7 589
庸人自扰
庸人自扰 2020-11-22 02:44

I\'m trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background

7条回答
  •  臣服心动
    2020-11-22 03:14

    You probably want the answer to "How to call an external command in Python".

    The simplest approach is to use the os.system function, e.g.:

    import os
    os.system("some_command &")
    

    Basically, whatever you pass to the system function will be executed the same as if you'd passed it to the shell in a script.

提交回复
热议问题