regarding system function

Roman Neuhauser neuhauser+python-list#python.org at sigpipe.cz
Fri Apr 22 03:40:55 EDT 2005


# prabapython at yahoo.co.in / 2005-04-22 08:35:33 +0100:
> 
> --- Robert Kern <rkern at ucsd.edu> wrote:
> > praba kar wrote:
> > >      In Php If I send a command to system function
> > > then It will return 1 on success and 0 on failure.
> > >  So based upon that value I can to further work.
> > > 
> > >      But In Python If I send a command to system
> > > function then It will return 0 only for both
> > > conditions(success and failure).
> > 
> > Are you sure about that?
> > 
> > In [3]:os.system('cat foo')
> > cat: foo: No such file or directory
> > Out[3]:256
> > 
> 
> I agree above statement but When I delete a directory
> os.system('rm -rf test')
> 0
> if directory is not present then I again try to
> delete
> os.system('rm -rf test') 
> now this time also It will print
> 0

    that's the standard behavior of the -f switch

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991



More information about the Python-list mailing list