Changes

Jump to: navigation, search

OPS435 Python3 Lab 3

2 bytes removed, 18:28, 19 September 2019
PART 2 - Running System Commands with subprocess
:#Create a new python file for testing.
:#Import the '''''os''''' module in your python file.
:#You can issue operating system commands by using the '''system()''' function. Try it:<source lang="python">
os.system('ls')
os.system('whoami')
os.system('ifconfig')
</source>Notice that the output from the system programs '''ls''', '''whoami''', and '''ifconfig''' is printed on your screen. Try to compare them with the output from the following function calls:<source lang="python">
ls_return = os.system('ls')
print('The contents of ls_return:',ls_return)
1,760
edits

Navigation menu