system call in python

Pierre Rouleau pieroul_nospam_ at attglobal.net
Thu Aug 14 01:46:18 EDT 2003


Catherine Yang wrote:

> Hi,
> 
> 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?
> 

You can use the os.system() to execute a program accessible from your 
path or specified explicitly:

 >>> import os
 >>> os.system('ls')

For more info on process control, take a look at:

http://www.python.org/doc/current/lib/os-process.html





More information about the Python-list mailing list