<div>Hey,</div> <div> </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><BR><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>
<!--2--><hr size=1></hr> Unlimited freedom, unlimited storage. <a href="http://in.rd.yahoo.com/tagline_mail_2/*http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/">Get it now</a>