Answers for "how to run code in python shell"

0

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
Posted by: Guest on October-31-2021

Code answers related to "how to run code in python shell"

Python Answers by Framework

Browse Popular Code Answers by Language