On 03/06/2014 02:22 PM, teddyb...@gmail.com wrote:
I am using beautifulsoup to get the title and date of the website.
title is working fine but I am not able to pull the date. Here is the code in 
the url:

  <span class="date">October 22, 2011</span>

In Python, I am using the following code:
date1 = soup.span.text
data=soup.find_all(date="value")

Results in:

[]
March 5, 2014

What is the proper way to get this info?
Thanks.


I believe it's the 'attrs' argument.
http://www.crummy.com/software/BeautifulSoup/bs4/doc/

# Workaround the 'class' problem:
data = soup.find_all(attrs={'class': 'date'})

I haven't tested it, but it's worth looking into.

--
\¯\      /¯/\
 \ \/¯¯\/ / / Christopher Welborn (cj)
  \__/\__/ /  cjwelborn at live·com
   \__/\__/   http://welbornprod.com

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to