[Tutor] lxml.html
Walter Prins
wprins at gmail.com
Thu Jun 9 16:50:27 CEST 2011
Hello Nitin,
On 9 June 2011 15:10, nitin chandra <nitinchandra1 at gmail.com> wrote:
> The following is the html code in index.py
>
> html = "<html><head><title>C Informatics</title></head><body>"
> html += "<h1><center>Hospital Management & Information
> System</h1><br>"
> html += '<p><br>'
> html += '<p><br>'
> html += '<p><br>'
> html += '<center>'
> html += '<form method="post" action="response.py">'
> html += 'User Name :<input type="text" name="name"><br>'
> html += 'Password   :<input type="password"
> name="paswd1"><br>'
> html += '<table>'
> html += '<TR/><TD NOWRAP/>Highest Qualifications:'
> html += '<TD/><SELECT name="hiqual"/>'
> html += '<OPTION/>Ph.D / Doctorate'
> html += '<OPTION/>Post Graduation'
> html += '<OPTION/>Post Graduation Diploma'
> html += '<OPTION SELECTED/>Graduation'
> html += '<OPTION/>Diploma'
> html += '<OPTION/>Undergraduate'
> html += '</SELECT/><br>'
> html += '<input type="submit" Value="Log In">'
> html += '</form>'
> html += '</center>'
> html += "</body></html>"
>
> That's not HTML, that's python code that builds up HTML in a string. (As an
aside, it does that in a rather inefficient way.)
lxml.html is for parsing HTML, it's not meant for parsing "python that
builds HTML". To belabor the point, lxml.html is meant for proper HTML,
nothing else. Therefore, you should be feeding a text file (HTML file) into
LXML, not a piece of python code that builds HTML.
Where did you get that HTML? How did it get to be part of the python code
above?
Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110609/540ff38e/attachment-0001.html>
More information about the Tutor
mailing list