Re: help with for loop----python 2.7.2

2014-03-23 Thread Ian Kelly
On Mar 23, 2014 3:56 PM, "tad na" wrote: > > This is the error I get with > 1. print data[x].pubDate.text > AttributeError: 'NoneType' object has no attribute 'text' > 2. print data[x].pubDate > It results in "None" So the problem is that it's not even finding the pubDate tag in the first

Re: help with for loop----python 2.7.2

2014-03-23 Thread Ben Finney
teddyb...@gmail.com writes: > I am trying to get all the element data from the rss below. […] > from bs4 import BeautifulSoup > > soup = BeautifulSoup(urlopen('http://bl.ocks.org/mbostock.rss')) RSS is not HTML; so BeautifulSoup is not a good tool to use for parsing RSS. Instead, you will do

Re: help with for loop----python 2.7.2

2014-03-23 Thread tad na
On Sunday, March 23, 2014 12:49:11 PM UTC-5, Ian wrote: > On Mar 23, 2014 11:31 AM, "tad na" wrote: > > OK . second problem :) > > I can print the date.  not sure how to do this one.. > Why not? What happens when you try? > > try: > >     from urllib2 import urlopen > > except ImportError: > >

Re: help with for loop----python 2.7.2

2014-03-23 Thread Mark Lawrence
On 23/03/2014 17:30, tad na wrote: On Sunday, March 23, 2014 12:29:40 PM UTC-5, tad na wrote: On Saturday, March 22, 2014 6:21:30 AM UTC-5, tad na wrote: 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

Re: help with for loop----python 2.7.2

2014-03-23 Thread tad na
On Sunday, March 23, 2014 12:40:04 PM UTC-5, Mark Lawrence wrote: > On 23/03/2014 17:30, tad na wrote: > Would you please use the mailing list > https://mail.python.org/mailman/listinfo/python-list or read and action > this https://wiki.python.org/moin/GoogleGroupsPython to prevent us > seeing d

Re: help with for loop----python 2.7.2

2014-03-23 Thread Ian Kelly
On Mar 23, 2014 11:31 AM, "tad na" wrote: > OK . second problem :) > I can print the date. not sure how to do this one.. Why not? What happens when you try? > try: > from urllib2 import urlopen > except ImportError: > from urllib.request import urlopen > import urllib2 > from bs4 import

Re: help with for loop----python 2.7.2

2014-03-23 Thread Mark Lawrence
On 23/03/2014 17:30, tad na wrote: Would you please use the mailing list https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. -- My fellow Pyth

Re: help with for loop----python 2.7.2

2014-03-23 Thread tad na
On Sunday, March 23, 2014 12:29:40 PM UTC-5, tad na wrote: > On Saturday, March 22, 2014 6:21:30 AM UTC-5, tad na wrote: > > > 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 l

Re: help with for loop----python 2.7.2

2014-03-23 Thread tad na
On Saturday, March 22, 2014 6:21:30 AM UTC-5, tad na wrote: > 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 urlli

Re: help with for loop----python 2.7.2

2014-03-22 Thread Ian Kelly
On Sat, Mar 22, 2014 at 5:21 AM, wrote: > 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 [SNIP] > for item in soup.find_all('item'): >