473,394 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
4 12246

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: A. T. | last post by:
My First time here, I am trying to write a program in python that can parse simple sentences like: ''I need a train from London to Brighton'' and get a query response from a database. Can...
8
by: anilby | last post by:
Hi, I wanted to write a script that will read the below file: <abcd label="ABC"> .. <efg label="EFGA"> ..... <decg label="ABDG"> ...
2
by: praba kar | last post by:
Dear all, I want to parse the system functions output but I couldn't do it. Kindly assist me in this task. eg) bytesused = os.system('du -sh /Users/enmail') if I print this bytesused...
14
by: jas | last post by:
I would like to redirect the output from os.system to a variable, but am having trouble. I tried using os.popen(..).read() ...but that doesn't give me exactly what i want. ...this is windows by...
1
by: Daniel | last post by:
how to parse xsl:output ... with xpath? "./xsl:output" does not work. is there other notation for this?
8
by: redefined.horizons | last post by:
I did some searching for this topic, but couldn't find anything. A search of this list only turned up an old post from 2002. I'd like to add a comprehesive help system to my Python Application....
0
by: Chris Withers | last post by:
Hi All, I'm proud to announce that after almost a year's development, the first public release of Twiddler is available! Twiddler is a simple but flexible templating system for dynamically...
2
by: loketing | last post by:
Is there any way to redirect the output of the system() function? I know there is for redirecting stdout, but I can't make this work with system(). I tried to store the output of a system command...
1
by: dragrid | last post by:
would like to read and parse certain fields from multiple lines ( say lines 5 and 9 and the first and sixth fields respectively) from the variable of the file the command output created tried this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.