Popular recipes by George Benko http://code.activestate.com/recipes/users/2826167/2006-03-24T00:38:28-08:00ActiveState Code Recipespipe convenience function for doing pipes as in bash (Python)
2006-03-24T00:38:28-08:00George Benkohttp://code.activestate.com/recipes/users/2826167/http://code.activestate.com/recipes/475171-pipe-convenience-function-for-doing-pipes-as-in-ba/
<p style="color: grey">
Python
recipe 475171
by <a href="/recipes/users/2826167/">George Benko</a>
(<a href="/recipes/tags/sysadmin/">sysadmin</a>).
</p>
<p>Allows arbitrary number of commands to be strung together with each one feeding into the next ones input. Syntax is simple: x=pipe("cmd1", "cmd2", "cmd3").read() is equivalent to bash command x=<code>cmd1 | cmd2 | cmd3</code>.</p>
<p>Works under python 2.4.2</p>