Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to run shell command in python

import subprocess

process = subprocess.Popen(['echo', 'hi'],
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
out, err = process.communicate()
print(out) # hi
print(err) # None
 
PREVIOUS NEXT
Tagged: #run #shell #command #python
ADD COMMENT
Topic
Name
6+7 =