import urllib2
from BeautifulSoup import *
resp = urllib2.urlopen("file:///D:/sample.html")
rawhtml = resp.read()
resp.close()
print rawhtml
I am using this code to get text from a html document, but it also gives me html code.
What should i do to fetch only text from the html document?
Note that your example makes no use of Beautifulsoup.
See the doc, and follow examples.
The following example, taken from the link above, searches the
soupfor<td>elements.