displaying properly formatted output of ipconfig.exe

Francis Avila francisgavila at yahoo.com
Sat Nov 8 18:11:33 EST 2003


"Joe Flynt" <joe.flynt at mail.portland.co.uk> wrote in message
news:601be7f8.0311081449.24b3f7e2 at posting.google.com...
> but when I view http://server/cgi-bin/test.py i get the following
> format of output:
> ['\r\n', 'Windows IP Configuration\r\n', '\r\n',
> etc.

> #!C:\Python23\python.exe
> import os
> print "Content-type: text/html\r\n\r\n"
> cmdpipe = os.popen("ipconfig","r")
> lines = cmdpipe.readlines()
> print lines

You don't want to print a list of strings, you want to print each string in
a list....

  lines = cmdpipe.readlines()
- print lines
+ for line in lines:
+     print line
--
Francis Avila





More information about the Python-list mailing list