1,760
edits
Changes
→PART 2 - Launching Linux command and controlling its process with builtin functions in os and subprocess modules
:#Try another one:<source lang="python">
ipconfig_return = os.popen('ipconfig')
ipconfig_contents = ipconfig_return.read()print('The contents of ipconfig_return:',ipconfig_returnipconfig_contents)
</source>
<br><br>As you may recall from lab2, you issued '''import sys''' to import special object from that built-in module. You can also import the subprocess module to load a function called '''Popen()''' which will allow you to have better control of the output produce by Linux commands like 'ls', 'whoami', and 'ifconfig', etc. <br><br>