system call in python
skchim0 at engr.uky.edu
Thu Aug 14 07:45:51 CEST 2003
I think you can do the following:
commands.getstatusoutput("...your command to execture program...")
On Thursday 14 August 2003 01:37 am, Graham Fawcett wrote:
> Catherine Yang wrote:
> >A question about how to execute a system command from python program. e.g.
> >in a python script, I need to run another program written in C++, and
> > after that come back to the same python program.
> >Is it the system module, and which function do I use to do this?
> >Thanks a lot
> Probably you are looking for os.system, as in:
> import os
> cmd = 'ls -l /usr/bin'
> Note that this will not capture the output of the system command; you
> can use the os.popen family of commands to do that.
> -- Graham
GRAD. RESEARCH ASSISTANT
UNIVERSITY OF KENTUCKY
More information about the Python-list