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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.