I am trying to get all the element data from the rss below.
The only thing I am pulling is the first element.
I don't understand why the for loop does not go through the entire rss.
Here is my code....


try:
    from urllib2 import urlopen
except ImportError:
    from urllib.request import urlopen 

from bs4 import BeautifulSoup 

soup = BeautifulSoup(urlopen('http://bl.ocks.org/mbostock.rss'))
#print soup.find_all('item')
#print (soup)

for item in soup.find_all('item'):
#for item in soup:    
    title = soup.find('title').text    
    link = soup.find('link').text
    item = soup.find('item').text
    print item
    print title
    print link
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to