On 21/08/11 18:15, ANKUR AGGARWAL wrote:
Hey
I am executing a grep command in my python program using os.system.

I guess the first question is why?
Python's re module can do pretty much anything that grep can do
and do it inside your program with no extra processes being
started.

Why not just use the re module?

or the result of the executed grep command in some form. Can you guys
tell me how to store the output of a terminal or show the output in a
GUI in python??

If you really must start an external program then
the best solution these days is to use the subprocess module.
The system() call is very rarely the best solution for anything
other than a very basic fire 'n forget command.

The subprocess documentation gives lots of example usage,
one of them should be right for you.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to