Chaining programs with pipe
Grant Edwards
grante at visi.com
Tue Aug 21 23:33:52 EDT 2007
On 2007-08-22, Karthik Gurusamy <kar1107 at gmail.com> wrote:
> Not sure on non-unix platforms, but in unix like platforms it's best
> to reuse shell's power.
>
>>>> import commands
>>>> commands.getoutput('ls | wc')
> ' 4 4 24'
>>>>
Executing a shell just because you want a pipe seems like a bit
of overkill. Doing it the "right" way with subprocess is
pretty trivial.
--
Grant Edwards grante Yow! I was born in a
at Hostess Cupcake factory
visi.com before the sexual
revolution!
More information about the Python-list
mailing list