RosettaCodeData/Task/Execute-a-system-command/Python/execute-a-system-command-3.py

4 lines
112 B
Python

from subprocess import PIPE, Popen, STDOUT
p = Popen('ls', stdout=PIPE, stderr=STDOUT)
print p.communicate()[0]