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 maillist  -  Tutor@python.org



 I actually had the same question a while back. I'm still a newbie, but the
advice I was given was  to use popen(). ls = os.popen("ls").read() worked
for me. Also, for Unix style OSes, you can import commands, and then it has
getoutput().
Just my two cents.

- Drew
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to