The pipes Module
(Unix only) The pipes module shown in Example 3-8 contains support functions to create "conversion pipelines." You can create a pipeline consisting of a number of external utilities and use it on one or more files.
Example 3-8. Using the pipes Module
File: pipes-example-1.py
import pipes
t = pipes.Template()
# create a pipeline
t.append("sort", "--")
t.append("uniq", "--")
# filter some text
t.copy("samples/sample.txt", "")
Alan Jones (sensible party)
Kevin Phillips-Bong (slightly silly)
Tarquin Fin-tim-lin-bin-whin-bim-lin-bus-stop-F'tang-F'tang-Olé-Biscuitbarrel
Категории