Answers for "get output from os.system"

3

python get output of command to variable

import subprocess as sp
output = sp.getoutput('whoami --version')
print (output)
Posted by: Guest on June-15-2020
0

python get output

>out = subprocess.Popen(['wc', '-l', 'my_text_file.txt'], 
           stdout=subprocess.PIPE, 
           stderr=subprocess.STDOUT)
Posted by: Guest on December-12-2020

Code answers related to "get output from os.system"

Python Answers by Framework

Browse Popular Code Answers by Language