<div><BR>Hey,</div>  <div>I did write the following,</div>  <div>but it does not work.</div>  <div> </div>  <div>import subprocess as sp<BR>try:</div>  <div>     = sp.Popen("DIR . /AD /B", stdout=sp.PIPE)<BR>    result = p.communicate()[0]<BR>    print result           <BR> except:   </div>  <div>     print "error"</div>  <div> </div>  <div>This throws error.</div>  <div>DIR . /AD /B will list out only directories in the current directory.</div>  <div> </div>  <div>Thanks,</div>  <div>Indu<BR><B><I>"Diez B. Roggisch" <deets@nospam.web.de></I></B> wrote: </div>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">indu_shreenath schrieb:<BR>> Hey,<BR>> I want to get the output of "DIR /AD /B" command to a varriable using <BR>> python. How can I do
 this?<BR><BR>Using the subprocess-module.<BR><BR><BR>However, I'm not sure what DIR /AD /B does - but there are many <BR>functions in module os that might deliver what you want without invoking <BR>an external command.<BR><BR>Diez<BR>-- <BR>http://mail.python.org/mailman/listinfo/python-list<BR></BLOCKQUOTE><BR><p>


      <!--4--><hr size=1></hr> 5, 50, 500, 5000 - Store unlimited mails in your inbox. <a href="http://in.rd.yahoo.com/tagline_mail_4/*http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/">Click here.</a>