Answers for "python execute a command and get the output"

3

how to run linux command in python

import os
cmd = 'your command here'
os.system(cmd)
Posted by: Guest on May-18-2020
2

python run command and read output

>>> subprocess.check_output(['ls', '-l'])
b'total 0n-rw-r--r--  1 memyself  staff  0 Mar 14 11:04 filesn'
Posted by: Guest on August-10-2020

Code answers related to "python execute a command and get the output"

Python Answers by Framework

Browse Popular Code Answers by Language