Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105023 > unrolled thread
| Started by | eproser@gmail.com |
|---|---|
| First post | 2016-03-16 06:36 -0700 |
| Last post | 2016-03-16 10:25 -0700 |
| Articles | 5 — 2 participants |
Back to article view | Back to comp.lang.python
Beautifulsoap eproser@gmail.com - 2016-03-16 06:36 -0700
Re: Beautifulsoap Joel Goldstick <joel.goldstick@gmail.com> - 2016-03-16 10:08 -0400
Re: Beautifulsoap eproser@gmail.com - 2016-03-16 08:01 -0700
Re: Beautifulsoap eproser@gmail.com - 2016-03-16 10:07 -0700
Re: Beautifulsoap eproser@gmail.com - 2016-03-16 10:25 -0700
| From | eproser@gmail.com |
|---|---|
| Date | 2016-03-16 06:36 -0700 |
| Subject | Beautifulsoap |
| Message-ID | <9c194be2-d47f-477f-a560-084b46415d7f@googlegroups.com> |
Greetings NG please I need a little help. I have this bs object tag: <td class="odds" data-odd="5.69"> I want extract 5.69 Some have pity of me :-) Thanks
[toc] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2016-03-16 10:08 -0400 |
| Message-ID | <mailman.207.1458137291.12893.python-list@python.org> |
| In reply to | #105023 |
On Wed, Mar 16, 2016 at 9:36 AM, <eproser@gmail.com> wrote: > Greetings NG > > please I need a little help. > > I have this bs object tag: > > <td class="odds" data-odd="5.69"> > > I want extract 5.69 > > Some have pity of me :-) > > Thanks > > > Show the code you have, and what isn't working. Which verision of python and BS > -- > https://mail.python.org/mailman/listinfo/python-list > -- Joel Goldstick http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays> http://cc-baseballstats.info/
[toc] | [prev] | [next] | [standalone]
| From | eproser@gmail.com |
|---|---|
| Date | 2016-03-16 08:01 -0700 |
| Message-ID | <5e47f1c7-6217-43c7-9464-c445f8ded2df@googlegroups.com> |
| In reply to | #105031 |
Yes, for my hobby i want extract odds.
The code is:
from bs4 import BeautifulSoup
import urllib2
url = "http://www.betexplorer.com/soccer/england/premier-league-2014-2015/results/"
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content)
odds = soup.find_all("td", class_="odds")
for odd in odds:
print odd
And I have this list of object:
...
<td class="odds" data-odd="3.70"></td>
<td class="odds" data-odd="3.65"></td>
<td class="odds" data-odd="3.48"></td>
From this object I'm interesting only 3.70 3.65 3.48 etc
I'm no a programmer, my hobby is analyze soccer matchs to try to win :-)
I chose python because I think is the best :-)
Thank you in advance
[toc] | [prev] | [next] | [standalone]
| From | eproser@gmail.com |
|---|---|
| Date | 2016-03-16 10:07 -0700 |
| Message-ID | <1abb96c7-e8eb-4aef-9de7-2752854059f8@googlegroups.com> |
| In reply to | #105043 |
Solved:
odds = soup.findAll('td',{'class':'odds'})
for odd in odds:
print odd['data-odd']
Thanks
[toc] | [prev] | [next] | [standalone]
| From | eproser@gmail.com |
|---|---|
| Date | 2016-03-16 10:25 -0700 |
| Message-ID | <e1dd9fb0-9653-413c-8f04-a52922918783@googlegroups.com> |
| In reply to | #105054 |
Thank you Peter, good info.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web