Monday, April 23, 2007

system call in python - Python

system call in python - Python
Probably you are looking for os.system, as in:

import os
cmd = 'ls -l /usr/bin'os.system(cmd)

Note that this will not capture the output of the system command; youcan use the os.popen family of commands to do that.
-- Graham

Hi,
I think you can do the following:
import commands
commands.getstatusoutput("...your command to execture program...")

SATISH------------------

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

[color=blue][color=green][color=darkred]
>>> import os
>>> os.system('ls')[/color][/color][/color]

For more info on process control, take a look at:
http://www.python.org/doc/current/lib/os-process.html

0 Comments:

Post a Comment

<< Home