On Aug 6, 8:07 pm, 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
Just an FYI, the os.system, commands, and os.popen* stuff is deprecated in Python 2.4+. The subprocess module is supposed to replace them all. See the docs for more info: http://docs.python.org/lib/module-subprocess.html I think the equivalent is subprocess.Popen with the communicate() method: http://docs.python.org/lib/node532.html HTH Mike -- http://mail.python.org/mailman/listinfo/python-list