how to get output.
Indu Shreenath
indu_shreenath at yahoo.co.in
Thu Aug 9 03:20:49 EDT 2007
Hey,
I did write the following,
but it does not work.
import subprocess as sp
try:
= sp.Popen("DIR . /AD /B", stdout=sp.PIPE)
result = p.communicate()[0]
print result
except:
print "error"
This throws error.
DIR . /AD /B will list out only directories in the current directory.
Thanks,
Indu
"Diez B. Roggisch" <deets at nospam.web.de> wrote:
indu_shreenath schrieb:
> Hey,
> I want to get the output of "DIR /AD /B" command to a varriable using
> python. How can I do this?
Using the subprocess-module.
However, I'm not sure what DIR /AD /B does - but there are many
functions in module os that might deliver what you want without invoking
an external command.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
---------------------------------
5, 50, 500, 5000 - Store unlimited mails in your inbox. Click here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070809/422c9b02/attachment.html>
More information about the Python-list
mailing list