Answers for "python shell command line"

0

os run shell command python

import os
os.system('ls -l')
Posted by: Guest on October-29-2021
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

Python Answers by Framework

Browse Popular Code Answers by Language