This is part of a code for text summarization using 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)
Here is the error
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'