-5
這是使用NLTK的文本摘要守則的一部分:我試圖運行,下面這段代碼,這是給我的錯誤
import urllib
feed_xml = urllib.urlopen('http://feeds.bbci.co.uk/news/rss.xml').read()
feed = BeautifulSoup(feed_xml.decode('utf8'))
to_summarize = map(lambda p: p.text, feed.find_all('guid'))
fs = FrequencySummarizer()
for article_url in to_summarize[:5]:
title, text = get_only_text(article_url)
print ('----------------------------------')
print (title)
for s in fs.summarize(text, 2):
print ('*',s)
以下是錯誤
C:\Python34>2.py
Traceback (most recent call last):
File "C:\Python34\2.py", line 2, in <module>
feed_xml = urllib.urlopen('http://feeds.bbci.co.uk/news/rss.xml').read()
AttributeError: 'module' object has no attribute 'urlopen'
你到現在爲止嘗試本地化你的錯誤?告訴我們你的努力。 – Aracthor
如果你想知道你的問題爲什麼被低估:最可能的原因是你的頭銜相當可怕(描述問題本身,不是你有問題,*所有*問題都要求幫助),錯誤信息是微不足道的,可以隨時找到你的答案。 –