Python cgi script

Yong Wang yong at net.tamu.edu
Thu Aug 5 11:54:47 EDT 2004


Hi, All:
    I try to write a CGI script to post network traffic routing info in the web page.
I have successfully obtained traffic info from wraped python with C++ and MYSQL and 
SNMP code and output to a file. I need read a file which contain traffic info and 
post to web. In CGI script, I use:
file=open('/apps/www/htdocs/internal/nd/output1', 'r')
flag=0
while not flag
    aLine = file.readline()
    if aLine != "":
        print aLine
        print '\n'
    else:
        flag = 1
file.close()
print "</body>"
print "</html>" 
The output from print statement above in web can display, but  no line separation between different lines.
How can I preserve the orginal line format of the input file (space within a line and space between lines)? 
     Thank you very much for your help in advance.

     I am looking forward to receiving your reply.

            Yong




More information about the Python-list mailing list