On 10/16/07, Shoryuken <[EMAIL PROTECTED]> wrote: > > I guess that you want to loop over a file and for each line in the > > file you want to call some > > external program with the line as the argument. > > > > Have a look at subprocess module > > http://docs.python.org/lib/module-subprocess.html > > > > If there is some else that you meant, please specify . > > > Thanks alot, its working now. But I have another question (sorry I'm > so noob), how can I redirect a command's output to a file (just like > executing a linux command "dmesg>>stat.txt")?
Since subprocess module allow you to call programs through (linux) shell , you can use the same syntax in your command. example: >>> from subprocess import call >>> call("echo foo >> bar.txt", shell=True) Cheers, -- -- Amit Khemka -- http://mail.python.org/mailman/listinfo/python-list