
March 10th, 2013, 10:26 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 18
Time spent in forums: 14 h 30 m 46 sec
Reputation Power: 0
|
|
|
Grabbing next set of results from webpage
I have written a program that pulls results from a webpage and returns it on the screen, however, I would like it to return more than one result, and the different players. Obviously, this would involve some form of loop, probably a for loop. But all it does is return the same name. I would like it to eliminate that result from the selection after processing it.
Code:
import urllib.request
data = urllib.request.urlopen('http://www.football-league.co.uk/page/DivisionalScorers/0,,10794~20127,00.html')
e = data.read()
m = e.decode('utf8')
splitted_page = m.split('<div class="statistics">')
splitted_page = splitted_page[1].split('</div>')
splitted_page2 = splitted_page[0].split('<tr class="rowDark">')
splitted_page2 = splitted_page2[1].split('</tr>')
splitted_page3 = splitted_page2[0].split('<td style="text-align:center;">')
splitted_page3 = splitted_page3[1].split('</td>')
splitted_page4 = splitted_page2[0].split('<td>')
splitted_page4 = splitted_page4[1].split('</td>')
splitted_page5 = splitted_page4[0].split('>')
splitted_page5 = splitted_page5[1].split('<')
print(splitted_page5[0])
print(splitted_page3[0])
What it is doing is splitting the page up into several parts until all that remains is what I am looking for.
Edit: I'm using python 3
Last edited by noskiw : March 10th, 2013 at 10:34 AM.
Reason: Forgot to mention python 3
|