a popen command line question

Joni Lee webcokies at yahoo.com
Sat Aug 29 16:13:12 EDT 2009


Hi all,

I write a small script

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

It calls the command line "top" and will print out the status.
But I have to press the keyboard "q" to quit "top", then the status 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 (for gathering information)

Sorry the question is weird.



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


More information about the Python-list mailing list