Python Script execute commands in Terminal

前端 未结 9 1727
余生分开走
余生分开走 2020-11-29 16:51

I read this somewhere a while ago but cant seem to find it. I am trying to find a command that will execute commands in the terminal and then output the result.

For

9条回答
  •  感动是毒
    2020-11-29 17:02

    for python3 use subprocess

    import subprocess
    s = subprocess.getstatusoutput(f'ps -ef | grep python3')
    print(s)
    

提交回复
热议问题