[Tutor] lxml.html

nitin chandra nitinchandra1 at gmail.com
Thu Jun 9 16:10:05 CEST 2011


Sorry, did not realise , on clicking "Reply", I was mailing only to
you. Thank you for pointing that out.

Duly complied.

>>>> TypeError:
>>>> cannot concatenate 'str' and 'NoneType' objects
>>
>>>> I am extracting form field name / value from an html, but then it
>>>> gives the above error and does
>>>> not display the value of the variable 'name' entered in the respective
>>>> form.
>>>
>>> What is the value of the variable 'name'?
>>
>> Value entered in the form is 'admin'
>
> I didn't ask what the value entered in the form is. Where does the form go?
> Where are you looking? Are you sure you're looking in the right place?

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&nbsp&nbsp&nbsp:<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>"

>
> You're looking at a file /home/dev/wsgi-scripts/index.py and trying to
> extract XML from that file. What's inside that file?

With lxml.html i am looking to extract 'name="variable" ' from it.

Thank you

Nitin


More information about the Tutor mailing list