os.system() question
Chris Rebert
clp2 at rebertia.com
Mon Oct 19 14:30:53 EDT 2009
On Mon, Oct 19, 2009 at 11:14 AM, Bryan Irvine <sparctacus at gmail.com> wrote:
> I'm a python n00b and so pardon me in advance if this is really stupid
> question.
>
> I have my suspicions but why does the following not work the way I'm
> anticipating it will?
>
> (python 2.4.4)
>
>>>> import os
>>>> if (os.system('echo test')):
<snip>
It's best to avoid os.system(). Use the newer `subprocess` module instead:
http://docs.python.org/library/subprocess.html
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list