mercredi 21 janvier 2015

How to scrape specific text from a webpage in Python?

I want to quickly obtain the day's bet rate from winmasters.com.


This is what i have until now:



from lxml import html
import requests
page = requests.get('http://winmasters.com/')
tree = html.fromstring(page.text)
team = tree.xpath('//div["class="display-table"]/text()')
odds = tree.xpath('//span[@class="ng-binding ng-scope"]/text()')

print 'Team: ', team
print 'odds: ', odds


thx





Aucun commentaire:

Enregistrer un commentaire