<br><br><div><span class="gmail_quote">On 10/28/07, <b class="gmail_sendername">Lawrence Shafer</b> <<a href="mailto:detroit371@gmail.com">detroit371@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Why doesn't this fill otp with the output of ls?? (I know python has<br>it's own file tools, I'm just playing around ;)<br><br>import os<br>cmd="""ls"""<br>otp=os.system(cmd)<br>print otp
<br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a></blockquote><div><br><br> 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().<br>Just my two cents.<br><br>- Drew<br></div><br><br></div><br>