Say I have use
date = r.find('abbr')
to get
<abbr class="dtstart" title="2012-11-16T00:00:00-05:00">November 16, 2012</abbr>
I just want to print November 16, 2012
, but if I try
print date.string
I get
AttributeError: 'NoneType' object has no attribute 'string'
What am I doing wrong?
UPDATE: Here's my code Neither of the print pairs print the raw string, but the uncommented ones get the correct tags
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen("some-url-path")
soup = BeautifulSoup(page)
calendar = soup.find('table',{"class" : "vcalendar ical"})
for r in calendar.findAll('tr'):
# print ''.join(r.findAll('abbr',text=True))
# print ''.join(r.findAll('strong',text=True))
print r.find('abbr')
print r.find('strong')