how to get text from a html file?

Stefan Behnel stefan_ml at behnel.de
Tue Apr 13 20:26:07 CEST 2010


varnikat t, 13.04.2010 19:58:
> Can anyone tell me how to get text from a html file?I am trying to display
> the text of an html file in textview(of glade).If i directly display the
> file,it shows with html tags and attributes, etc. in textview.I don't want
> that.I just want the text.
> Can someone help me with this?

E.g. using lxml.html:

     import lxml.html as H
     html = H.parse("the_html_file.html")
     print H.tostring(html, method="text")

Stefan




More information about the Python-list mailing list