By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,950 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,950 IT Pros & Developers. It's quick & easy.

How to parse the os.system() output in python

P: n/a
Hi,

I use os.system() to execute a system command in python.
Can you please tell me how can I parse (in python) the output of the
os.system() ?

Thank you.

Mar 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a

On Mar 17, 2007, at 8:28 PM, yi*****@gmail.com wrote:
Hi,

I use os.system() to execute a system command in python.
Can you please tell me how can I parse (in python) the output of the
os.system() ?

Thank you.

Sounds like you want os.popen, not os.system.

http://docs.python.org/lib/module-popen2.html

Dave

Mar 18 '07 #2

P: n/a
On 17 Mar 2007 17:28:56 -0700, yi*****@gmail.com <yi*****@gmail.comwrote:
I use os.system() to execute a system command in python.
Can you please tell me how can I parse (in python) the output of the
os.system() ?
Maybe you mean to parse the output of the program you run using
os.system. If this is the case, you should redirect the putput of the
program to a file (with ">") and then parse that file.

Best,
SB.
Mar 18 '07 #3

P: n/a
how to redirect the putput of the
program to a file?

thanks.
"Sebastian Bassi" <sb****@clubdelarazon.orgwrote in message
news:ma***************************************@pyt hon.org...
On 17 Mar 2007 17:28:56 -0700, yi*****@gmail.com <yi*****@gmail.com>
wrote:
>I use os.system() to execute a system command in python.
Can you please tell me how can I parse (in python) the output of the
os.system() ?

Maybe you mean to parse the output of the program you run using
os.system. If this is the case, you should redirect the putput of the
program to a file (with ">") and then parse that file.

Best,
SB.

Mar 18 '07 #4

P: n/a
On 3/18/07, bruce peng <pe******@kingsoft.netwrote:
how to redirect the putput of the
program to a file?
like this:
program_name -parameters outfile.txt
Mar 18 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.