regarding system function

Robert Kern rkern at ucsd.edu
Fri Apr 22 02:55:44 EDT 2005


praba kar wrote:
> Dear All,
> 
>      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

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list