On Aug 7, 6:07 am, Kevin Walzer <[EMAIL PROTECTED]> wrote: > >>> import os > >>> foo = os.system('whoami') > kevin > >>> print foo > 0 > >>> > > The standard output of the system command 'whoami' is my login name. Yet > the value of the 'foo' object is '0,' not 'kevin.' How can I get the > value of 'kevin' associated with foo? > > -- > Kevin Walzer > Code by Kevinhttp://www.codebykevin.com
Why dont you try commands module instead.... In [28]: import commands In [29]: dir(commands) Out[29]: ['__all__', '__builtins__', '__doc__', '__file__', '__name__', 'getoutput', 'getstatus', 'getstatusoutput', 'mk2arg', 'mkarg'] In [30]: (a,b) = commands.getstatusoutput('whoami') In [31]: print a 0 In [32]: print b luma35 -- http://mail.python.org/mailman/listinfo/python-list