On Sun, Oct 23, 2011 at 7:51 PM, <aaabb...@hotmail.com> wrote: > On Oct 23, 7:44 pm, aaabb...@hotmail.com wrote: >> exp: >> os.system('ls -al') >> #I like to catch return value after this command. 0 or 1,2,3.... >> does python support to get "$?"? >> then I can use something like: >> If $?==0: <snip> > So for what I do is: > r_number =os.system('ls -al') > if r_number == 0 > ......... > ......... > any other way?
I would recommend using the `subprocess` module instead: http://docs.python.org/library/subprocess.html#convenience-functions Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list