Source

python-clinic / Doc / library / pipes.rst

Full commit

:mod:`pipes` --- Interface to shell pipelines

Source code: :source:`Lib/pipes.py`


The :mod:`pipes` module defines a class to abstract the concept of a pipeline --- a sequence of converters from one file to another.

Because the module uses :program:`/bin/sh` command lines, a POSIX or compatible shell for :func:`os.system` and :func:`os.popen` is required.

The :mod:`pipes` module defines the following class:

An abstraction of a pipeline.

Example:

>>> import pipes
>>> t = pipes.Template()
>>> t.append('tr a-z A-Z', '--')
>>> f = t.open('pipefile', 'w')
>>> f.write('hello world')
>>> f.close()
>>> open('pipefile').read()
'HELLO WORLD'

Template Objects

Template objects following methods: