Python Pipes Introduction














































Python Pipes Introduction



WHAT IS PIPES ?

The pipes module defines a class that is used to create complex Unix command pipelines.
A pipeline is like a set of instructions/commands chained together so that the output of each process is passed directly as input to the next one.

HOW TO INSTALL PIPES?

Open your terminal and run the following command:-

pip install pipe

Note:- The module uses /bin/sh command lines, so a POSIX or compatible shell is needed for os.system() and os.popen()

HOW TO USE IT ?

To import it we will simply use import pipes in our code and then create an instance of  pipes.Template()   to create a pipeline. This is how it should look -

import pipes
# pipes_object will be our pipeline object
pipes_object = pipes.Template()
And that's it we have successfully created a pipeline object, we can append various commands in our pipeline using the append() function which we will see in the next article,

Comments