beautiful soup get class info
teddybubu at gmail.com
teddybubu at gmail.com
Thu Mar 6 16:38:39 EST 2014
On Thursday, March 6, 2014 2:58:12 PM UTC-6, John Gordon wrote:
> In <e73d29eb-17bb-472e-bdc4-c38ca904c60f at googlegroups.com> teddy writes:
>
>
>
> > <span class="date">October 22, 2011</span>
>
>
>
> > date1 = soup.span.text
>
> > data=soup.find_all(date="value")
>
>
>
> Try this:
>
>
>
> soup.find_all(name="span", class="date")
>
>
>
> --
>
> John Gordon Imagine what it must be like for a real medical doctor to
>
> watch 'House', or a real serial killer to watch 'Dexter'.
I have python 2.7.2 and it does not like class in the code you provided. Now when I take out [ class="date"], this is returned:
[<span class="date">March 5, 2014</span>, <span class="date">March 5, 2014</span>]
This is the code I am using: "data = soup.find_all(name="span")
print (data)"
1. it returns today's date instead of the actual date
2. returns it twice
More information about the Python-list
mailing list