Executing a system call
Jorgen Grahn
jgrahn-nntq at algonet.se
Sat Mar 6 04:51:46 EST 2004
On Sat, 6 Mar 2004 00:06:14 +0530 (IST), Jagarlamudi Jagadeesh <j_jagdeesh at students.iiit.net> wrote:
>
>
> Hi All,
>
> There are so many ways to execute a system call like,
> getstatusoutput()
>
> os.system()
>
> fork()
> os.execvp()
>
> using popen
And also os.spawnv*(), which unlike fork/exec work on some non-Unixes.
> Of all these, which is the best to use ( interms of speed and
> resources) ?
It depends ;-) Some of these go through the shell (which may give you features
you want, or features you *don't* want). I'd say the resources wasted on
executing a shell are almost always negligable; you should probably make a
decision based on functionality instead.
/Jorgen
--
// Jorgen Grahn <jgrahn@ ''If All Men Were Brothers,
\X/ algonet.se> Would You Let One Marry Your Sister?''
More information about the Python-list
mailing list