Python obtiene salida de comando a variable
import subprocess as sp
output = sp.getoutput('whoami --version')
print (output)
Breakable Baboon
import subprocess as sp
output = sp.getoutput('whoami --version')
print (output)
os.popen('cat /etc/services').read()
>out = subprocess.Popen(['wc', '-l', 'my_text_file.txt'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)