The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
Examples using subprocess
Subprocess to execute and get output by executing dpkg -l
.
Piping command using subprocess by executing dpkg -l | grep lsof
.