system call in python

Pierre Rouleau pieroul_nospam_ at
Thu Aug 14 07:46:18 CEST 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:

More information about the Python-list mailing list