[Tutor] Reading an html file into a cgi script.

Kent Johnson kent_johnson at skillsoft.com
Tue Sep 14 12:38:02 CEST 2004


You don't seem to have shown us the code that generates the <td> lines. If 
the header file ends with the <table> line, where are the next lines generated?

Kent

At 01:14 AM 9/14/2004 -0500, Douglas N. Shawhan wrote:
>I would like to pull lines from an html file and include them in a cgi 
>script. (python2.1, openbsd 3.5, apache)
>
>I have a file called 'header.html', which contains the lines:
>
>'''Content-type: text/html\n\n'''
>'''<table><tr>'''
>
>I then attempt to load it from the script:
>
>HEADER = open('header.html', 'r')
>HEADER = HEADER.readlines()
>for line in HEADER:
>    print line
>
>The "Content-type" line may or may not be parsed correctly - it doesn't 
>show up in the output, but the html contained in the file is definitely 
>not parsed:
>
>'''<table><tr>'''
>
>
>
>Tue Sep 14 00:58:30 2004 | None | 1313 Mockingbird ln.| None | 
>1095141610.24 | 1095142510.24
><td>Tue Sep 14 00:58:30 2004 | None | 1313 Mockingbird ln.| None | 
>1095141610.24 | 1095142510.24</td>
><td>Tue Sep 14 00:58:30 2004 | None | 1313 Mockingbird ln.| None | 
>1095141610.24 | 1095142510.24</td>
><td>Tue Sep 14 00:58:30 2004 | None | 1313 Mockingbird ln.| None | 
>1095141610.24 | 1095142510.24</td>
><td>Tue Sep 14 00:58:30 2004 | None | 1313 Mockingbird ln.| None | 
>1095141610.24 | 1095142510.24</td>
>
>'''</table>'''
>
>
>
>Note that the first line has no <td> tags. *scratch* *scratch*
>
>What am I missing here?
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list