467,920 Members | 1,104 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,920 developers. It's quick & easy.

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

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
  • viewed: 11725
Share:
4 Replies

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
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
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
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.

Similar topics

1 post views Thread by A. T. | last post: by
8 posts views Thread by anilby | last post: by
2 posts views Thread by praba kar | last post: by
14 posts views Thread by jas | last post: by
8 posts views Thread by redefined.horizons | last post: by
reply views Thread by Chris Withers | last post: by
2 posts views Thread by loketing | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.