Re: [Tutor] os.sys

2007-10-28 Thread Alan Gauld
"Lawrence Shafer" <[EMAIL PROTECTED]> wrote > Why doesn't this fill otp with the output of ls?? (I know python has > it's own file tools, I'm just playing around ;) > > otp=os.system(cmd) Because os.system returnsd the exit status of the command. zero means the command executed OK anything else

Re: [Tutor] os.sys

2007-10-28 Thread Andrew Nelsen
On 10/28/07, Lawrence Shafer <[EMAIL PROTECTED]> wrote: > > Why doesn't this fill otp with the output of ls?? (I know python has > it's own file tools, I'm just playing around ;) > > import os > cmd="""ls""" > otp=os.system(cmd) > print otp > ___ > Tutor

Re: [Tutor] os.sys

2007-10-28 Thread James
Try using the commands, instead. import commands cmd = 'ls' opt = commands.getoutput( cmd ) print opt More information found here: http://docs.python.org/lib/module-commands.html :) .james On Oct 28, 2007, at 12:44 PM, Lawrence Shafer wrote: > Why doesn't this fill otp with the output of ls