import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
url = 'http://news.bbc.co.uk/2/hi/health/2284783.stm'
html = urllib.request.urlopen(url).read()
soup = BeautifulSoup(html)
for script in soup(['script', 'style']):
    script.extract()
text = soup.get_text()
lines = (line.strip() for line in text.splitlines())
chunks = (phrase.strip() for line in lines for phrase in line.split('  '))
text = '\n'.join(chunk for chunk in chunks if chunk)
print(text)
Extracting text from HTML file using Python