executing shell commands
Sean 'Shaleh' Perry
shaleh at valinux.com
Thu Feb 22 21:39:52 CET 2001
On 22-Feb-2001 chris lamb wrote:
> I am very new to Python and having to learn quickly! I am enjoying it,
> however. It is a flexible and intuitive environment.
> Can someone advise me if there is an equivalent to running a system process
> from inside a script as there is in Perl? I mean in perl if I use backticks
> to enclose a system command, then the command is executed. Is there a
> comparable way of running these commands from Python?
os.system() or os.popen()
system will run the command, but you do not get anything back other than an
exit status. popen() can launch and app and connect its output to a Python
file handler and let you read from it.
More information about the Python-list