a popen question. Please help

Joni Lee webcokies at yahoo.com
Sun Aug 30 07:19:10 EDT 2009


Hi all,

I write a small script

texts = os.popen('top').readlines()
print texts

It calls the command line "top" and will print out some texts.
But first I have to press the keyboard "q" to quit the subprocess "top", then the texts will be printed, otherwise it just stands by with blank.

Question
is. Do you know how to give "q" into my python script so that "top" is
automatically quit immediately or maybe after 1s and print out the texts.

Thank you



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090830/aa2db931/attachment.html>


More information about the Python-list mailing list