Calling external programs: ioredirection
Moshe Zadka
moshez at math.huji.ac.il
Wed Jun 7 10:24:18 EDT 2000
On Wed, 7 Jun 2000, Thaddeus L. Olczyk wrote:
> I want to do this in order to do things similar to sh. For example:
>
> wc -l *.h *.cpp|awk 'begin int i=0; {i+=$1 } end print i;}'
>
> ( I know the script is probably wrong, but you get the idea. )
>
> Any idea of how?
Yes, read about "os.popen" and "os.system". But the real answer is that
you *don't* want to do it -- Python has fine modules to do all those
things, and it's much easier and efficient to use them.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list