by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 2 years ago )

I use Python to execute the template of system commands

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import Popen, PIPE, STDOUT

command='uname -a'. split()

proc=Popen(command,bufsize=0, stdout=PIPE,stderr=PIPE, universal_newlines=True);
output, error = proc. communicate()

if (exit_code==0):

Tags: python

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


The python version of the tirm command

Record how to use python's tirm command

linux, python, colab

How to connect to colab from our Server through ssh?

Introduce a bash I wrote to connect to colab vm through ssh. One line of instructions, get colab OpenSSH Server.


Simple test python-thread function and parameters

Record, how to use thread to perform functions