[Tutor] Store the output of os.system

Emile van Sebille emile at fenx.com
Sun Aug 21 19:28:12 CEST 2011


On 8/21/2011 10:15 AM ANKUR AGGARWAL said...
> Hey
> I am executing a grep command in my python program using os.system. I
> want to store the output somewhere but because of GUI's involved
> (generated using tkinter and pyzenity) I am unable to store my output
> 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??

Instead of os.system, try the commands or subprocess module as 
appropriate for your version of python.

HTH,

Emile





More information about the Tutor mailing list