Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

5 bytes added, 13:17, 10 August 2017
PART 2 - Running System Commands with Subprocess
</source>
:#This next step is going to communicate with the process and get the stdout and stderr from the command we previously.<source>
stdout, stderr output = p.communicate()stdoutoutputoutput[0]
# The above stdout is stored in bytes
# Convert stdout to a string and strip off the newline characters
stdout = stdoutoutput[0].decode('utf-8').strip()
stdout
</source>