<br><br><div><span class="gmail_quote">On 10/28/07, <b class="gmail_sendername">Lawrence Shafer</b> &lt;<a href="mailto:detroit371@gmail.com">detroit371@gmail.com</a>&gt; 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&#39;t this fill otp with the output of ls?? (I know python has<br>it&#39;s own file tools, I&#39;m just playing around ;)<br><br>import os<br>cmd=&quot;&quot;&quot;ls&quot;&quot;&quot;<br>otp=os.system(cmd)<br>print otp
<br>_______________________________________________<br>Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Tutor@python.org">Tutor@python.org</a></blockquote><div><br><br>&nbsp;I actually had the same question a while back. I&#39;m still a newbie, but the advice I was given was&nbsp; to use popen(). ls = 
os.popen(&quot;ls&quot;).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>