Subprocess module

The standard subprocess module allows you to invoke processes from Python and communicate with them, send data to the input (stdin), and receive the output information (stdout). Using this module is the recommended way to execute operating system commands or launch programs (instead of the traditional os.system ()) and optionally interact with them.

Running a child process with your subprocess is simple. Here, the Popen constructor starts the process. You can also pipe data from your Python program into a subprocess and retrieve its output. With the help(subprocess) command, we can see that information:

The simplest way to ...

Get Mastering Python for Networking and Security now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.