使用BeautifulSoup从网页中提取文本
你好,
我想在一组网页上提取所有单词,然后将其存储在
大词典.然后,我希望获取最常见的清单
正在考虑的语言的单词.因此,我下面的代码读取
页面-http://news.bbc.co.uk/welsh/hi/newsi...00/7420967.stm
威尔士语言页面.我希望最常见的是建立1000个
在威尔士语中使用的单词.我遇到的问题是
汤.
u'doctypes html public' - // W3C // DTD HTML 4.0 Transitional // en en"" http://
www.w3.org/tr/rec-html40/loose.dtd"''
和 -
有什么建议,我如何克服这个问题?
谢谢,
巴里.
这是我的代码 -
导入Urllib
导入urllib2
来自美丽的小组
#proxy_support = urllib2.proxyhandler({" http":" http://
999.999.999.999:8080"})
#opener = urllib2.build_opener(proxy_support)
#urllib2.install_opener(开启器)
page = urllib2.urlopen('http://news.bbc.co.uk/welsh/hi/newsid_7420000/
newsID_7420900/7420967.stm')
汤=美丽的套(页)
pagetext = soup.findall(text = true)
打印pagetext